Indexing Into a List Value
Every member of a list value can be referenced by its index (its numeric position within the list). The index of the first member is zero.
To access a member of a list by its index, follow the list with the index value enclosed in square brackets.
If you attempt to access a member at an index before the beginning of the list, you get the first member of the list. If you attempt to access a member at an index beyond the end of the list, you get the last member of the list.
Examples
If it's given that
myList = {10, {345, -11}, 8, 60}
then
myList[0] | yields the value 10 |
myList[1] | yields the value {345, -11} |
myList[2] | yields the value 8 |
myList[3] | yields the value 60 |
myList[-1] | yields the value 10 |
myList[-277] | yields the value 10 |
myList[4] | yields the value 60 |
myList[500] | yields the value 60 |
You can apply further indexing to the result of the index operation, itself:
Since
then