  
List Element
Format: x[ y ]
Arguments: [any] x Input list
[int] y Element number(s)
Returns: [any] The zero-based y th element(s) in the list x
Description: This operator is used to extract one or more elements from a list. Note that
the first element in the list is x[0], not x[1]. If y is less than 0 or greater than the length of list x minus 1, null is returned.
If y contains a list of element numbers, a list of corresponding elements is
returned. For example, x[2..4] returns the third, fourth, and fifth elements in x.
If x is a matrix (list of lists), you can extract particular elements by using
this operator twice. For example, x[2][5] returns the element in column 3, row 6. You can also extract entire columns
or rows. For example, x[2] returns the entire third column. Similarly, x[][5] returns the entire sixth row. To extract a range in a matrix, enter a range
of values for the row and column numbers. x[2..3][3..5] returns all elements in columns 3 and 4 of rows 4, 5, and 6.
Note that x[y] and x#y are identical except that x[y] uses zero-based index numbers while x#y is one-based.
Examples: [11,12,13,14][0] = 11
[11,12,13,14][1..3] = [12,13,14]
["a","b","c"][2] = c
[[1,2],[3,4]][1] = [3,4]
[[1,2],[3,4]][1][0] = 3
x[count(x)-1] = last element in the list named x
See Also: Subscript, sublist, last, List Literal, Property
|