Why will not this code compile, I am new to Rust just so you now 
I get this error:
cannot be built from an iterator over elements of type 'bool'
fn even_nums(nums: &[i32]) {
let x: Vec<i32> = nums.iter().map(|num| num % 2 == 0).collect();
println!("{:?}", x);
}
It looks like you want filter instead of map
5 Likes
Indeed, filter
works better 
Thank you @andresovela
system
Closed
5
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.