method iter.any
true if some element satisfies p; stops at the first one.
Example:
fn main() io {
print("{[1, 2, 3].iter().any(x => x > 2)} {[1, 2, 3].iter().any(x => x > 5)}")
}Output
true false
pub(api) move fn any<effect F>(p: fn(T) -> bool F) -> bool FComplexity. O(n) at worst; stops at the first match.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
p | fn(T) -> bool F |
Returns
bool F
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/iter.oxl:687