Tinderbox v11 Icon

list[itemNum]


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Data Type Returned: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 List  [operators of similar scope]

 Dictionary, Set & List operations  [other Dictionary, Set & List operations operators]

 source context dependent

 v9.0.0

 Baseline

 As at baseline


list[itemNum]

sourceNum is the zero-based item number in the referenced List- or Set-type list.

Elements in lists, sets, may be extracted (referenced) with the bracket operator:

$MyList[1] 

This has the same effect as list.at( ), but may be more convenient. Both

$MyList[1] 
$MyList.at(1) 

Returns the second list item (as list item addresses are zero-based).

This syntax can also assign values to specific elements of lists. For example,

$MyList=[apple; pear; plum; cherry]; 
$MyList[1]="persimmon"; 

Will replace "pear" with "persimmon".

Nested lists

MyList = [cow;bee;[fish;whale];ant] 
$MyList[2][1] gives "whale"

See also—notes linking to here: