Synopsis
- float index(float[] array, float item)
- float index(float[] array, float item, float epsilon)
- float index(string[] array, string item)
- float index(bool[] array, bool item)
Parameters
- arrayArray for which an index is requested.
- itemItem value to look for.
- epsilonA tolerance in which float item values are considered to be equal. Default is 0.
Returns
The index of the first occurrence of item. If item is not found -1 is returned.
Description
The index function can be used to find a specific item value in an array. An epsilon tolerance can be specified in order to deal with floating point imprecision.
Related
Examples
Print index
indices = comp(fe) { all : comp.index }
Example --> print(indices) // (4)[0,1,2,4]
print(index(indices, 1)) // 1
print(index(indices, 2, 1)) // 1