index multimethod
Methods
- index(arr:Arr, pattern:Any=method, start:Int=0, dflt:Any=block) Source: stdlib.ngs:2770
Find index of the first value that matches the pattern. 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 compatibility in this case. Parameters
arr Items to look at pattern Test function or anything else acceptable by (=~), defaults to Bool.constructors 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 compatibility.Example
[1,2,11,3,4].index(X>10) # 2