std-method
Iterator::any — require at least one match
Return true at the first successful predicate and false if no match is found. Empty input yields false. Expected stdout (not executed): true Common mistake: Using any when all items must satisfy a rule.
Formal Syntax & Structure
rust syntaxrust
fn any<F>(&mut self, f: F) -> bool where Self: Sized, F: FnMut(Self::Item) -> boolWorking Example
Example Snippetrust
fn main() { let alarm = [17, 25, 19].into_iter().any(|n| n >= 24); println!("{alarm}");}