Created
February 15, 2019 16:21
-
-
Save konchunas/a0aa14a8f7d0c807a864fc411a57ab7d to your computer and use it in GitHub Desktop.
This file contains hidden or 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<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