Skip To Content

index function


  • 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)


  1. array
    Array for which an index is requested.
  2. item
    Item value to look for.
  3. epsilon
    A tolerance in which float item values are considered to be equal. Default is 0.


The index of the first occurrence of item. If item is not found -1 is returned.


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.



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

In this topic