Skip to content

Instantly share code, notes, and snippets.

@konchunas
Created February 15, 2019 16:21
Show Gist options
  • Save konchunas/a0aa14a8f7d0c807a864fc411a57ab7d to your computer and use it in GitHub Desktop.
Save konchunas/a0aa14a8f7d0c807a864fc411a57ab7d to your computer and use it in GitHub Desktop.
fn has_even<T0, RT>(numbers: T0) -> RT {
for num in numbers {
if num % 2 == 0 {
return true;
}
}
return false;
}
fn main() {
let vec = vec![1, 9, 2, 5];
let even_exists = has_even(vec);
println!("{:?} {:?} ", "Has even number", even_exists);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment