findfirst

.findfirst from:{Iterable<Any>} condition:{Lambda} -> Any

Finds the first element of a collection that satisfies a condition.

.var {numbers}
- 3
- 8
- 12

.numbers::findfirst {n: .n::isgreater than:{5}} <!-- 8 -->

Return

the first element that satisfies condition, or none if no element does

Parameters

from

collection to search in

condition

condition to check, which accepts one argument (the current element) and returns a boolean

Chaining

This function is designed to be chained with other function calls:
Iterable<Any>::findfirst condition:{Lambda} -> Any