Skip to content

Instantly share code, notes, and snippets.

@konchunas
Created February 15, 2019 16:39
Show Gist options
  • Save konchunas/48a961f58e3d3b5a0d9247d81c6382d9 to your computer and use it in GitHub Desktop.
Save konchunas/48a961f58e3d3b5a0d9247d81c6382d9 to your computer and use it in GitHub Desktop.
fn has_even(numbers: Vec<i32>) -> bool {
for num in numbers {
if num % 2 == 0 {
return true;
}
}
return false;
}
fn main() {
let vec = vec![1, 9, 2, 5, 4];
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