Skip to main content

Range.index_of

index_ofconditionstart

Group: Values

Documentation

Returns the index of an element in the range. Returns Nothing if the element is not found.

Arguments

  • condition: Either the element to search for, a Filter_Condition or a predicate function to test each element.
  • start: The index to start searching from. If the index is negative, it is counted from the end of the range.

Examples

Find the index of an element in a range.

      0.up_to 100 . index_of 20 == 20
0.up_to 100 . with_step 5 . index_of 20 == 4
0.up_to 100 . with_step 5 . index_of (>10) == 3