Range.find
findcondition start if_missing
Group: Selections
Documentation
Gets the first element of this range that satisfies a condition. If no element satisfies the condition, returns if_missing
.
Arguments
condition
: AFilter_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.if_missing
: Value returned if no element satisfies the predicate.
Examples
Get the first number in the range divisible by 2, 3 and 5.
1.up_to 100 . find i->(i%2==0 && i%3==0 && i%5==0)
Get the first number in the range that is greater than 10.
1.up_to 100 . find (..Greater than=10)