Skip to main content

List.find

findcondition start if_missing

Group: Selections

Documentation

Returns the first element of the list that satisfies the condition or if no elements of the list satisfy the predicate, returns if_missing.

Arguments

  • condition: 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 vector.
  • if_missing: Value returned if no element satisfies the predicate.

Examples

Finding a first element of the list that is larger than 2.

      import Standard.Examples

example_first = Examples.list.find (> 2)