[List] position: [Number] | Manual

[List] position: [Number]

Returns the element in the list at the specified position. Note that the first position of the list is index 0. If you attempt to retrieve an element of the list using a an index that is something other than a number a catchable error will be triggered. An error will also be triggered if your position is out of bounds (i.e. outside the list). Instead of the message 'position:' you can also send the message '?'.

 ☞ fruits  := List ← 'apples' ; 'oranges' ; 'bananas'.
 ☞ oranges := fruits position: 1.
 ☞ oranges := fruits ? 1.

Welcome to the Citrine Online Manual Pages. This online manual has been generated automatically from source code comments using the shtml.ctr script. All Citrine documentation is also available as a UNIX manual file included in the download package. These pages are just a web version of the original Citrine Programming Language User Manual and Reference Guide.

Improve this manual

You can help to improve this manual. Any help is appreciated! If you spot an error in this manual or you want to contribute, just change the corresponding comment in the original Citrine Programming Language source code hosted on github and create a 'Pull Request'. After the documentation generation script has been invoked again the manual pages will be updated to reflect your contribution and so will these online manual pages.

About Citrine

Citrine is an easy to use programming language for everyone. Citrine is so simple it does not even need special syntax for loops or conditions. You can learn Citrine in just a couple of minutes. Citrine makes programming fun again! Visit the homepage for a quick tutorial.

back to homepage | back to manual menu | top of page