[Array] indexOf: [Object]. | Manual
[Array] indexOf: [Object].
Checks whether the specified object occurs in the array and returns the index number
if so. If not, the index number -1 will be returned. Note that the comparison
will be performed by converting both values to strings.
☞ colors := Array ← 'red' ; 'green' ; 'blue' ; 3 ; (Array new) ; False ; Nil. ✎ write: (colors indexOf: 'green'), brk. #1 ✎ write: (colors indexOf: 'blue'), brk. #2 ✎ write: (colors indexOf: 'red'), brk. #0 ✎ write: (colors indexOf: 3), brk. #3 ✎ write: (colors indexOf: (Array new)), brk. #4 ✎ write: (colors indexOf: 'False'), brk. #5 ✎ write: (colors indexOf: Nil), brk. #6 ✎ write: (colors indexOf: 'purple'), brk. #-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.
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.