index multimethod
Methods
- index(arr:Arr, predicate:Any, start:Int=0, dflt:Any=[]) Source: stdlib.ngs:1781
Find index of first value that satisfies the predicate. TODO: Make it work on anything with each() method. In future, will throw exception if element is not found and default is not provided. Now returns null for backwards compatibilty in this case. Parameters
arr Items to look at predicate Test function start Index to start search at dflt default value to return when element is not found Returns
Int or dflt. Temporary also null, for backwards compatibilty.Example
[1,2,11,3,4].index(X>10) # 2