List.Contains() Or Something Similar?
Monkey Forums/Monkey Programming/List.Contains() Or Something Similar?
| ||
I know string lets us do a find/match with MyString.Contains(). Does List have something similar, or do I have to loop through it to find if something exists. [monkeycode] Local myList:IntList = [ 0, 1, 2, 4, 8, 16 ] Print myList.Find[ 7 ] Print myList.Find[ 8 ] ' prints ' -1 - not found in list (or 0, as was not found) ' 4 - as element of list myList[4] = 8 (or 5, as 5th element of list) [/monkeycode] I looked! Honest! |
| ||
list.monkey has this method: Method Contains?( value:T ) You're better off looking at the code than trusting the documentation to be up-to-date or accurate. |
| ||
Thanks, muddy. I'm not used to bad docs. XD Oops. What about Array? :-/ |
| ||
Well, you could look at the code as muddy shoes suggested :) In modules/monkey/lang.monkey the array class seems not to have a Contains Method. |