Vec from an Iterator

Published 331d ago

 Rob

Generate a Vec of even numbers from an iterator

fn main() {
    let v: Vec<i32> = (0..10).filter(|i| i % 2 == 0).collect();
    println!("{:?}\n", v);
}

0

Please login or sign up to comment and collaborate