OxL Reference

method iter.find

First element satisfying p; stops there.

Example:

oxl✓ checked in CI
fn main() io {
  print("{[1, 4, 9].iter().find(x => x > 3)}")
}
Output
4
pub(api) move fn find<effect F>(p: fn(T) -> bool F) -> T?  F

Complexity. O(n) at worst.

Since. 1.0.0-beta

Parameters

NameType
pfn(T) -> bool F

Returns

T? F

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/iter.oxl:723

See also