Created
February 15, 2019 16:39
-
-
Save konchunas/48a961f58e3d3b5a0d9247d81c6382d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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