pmacs3/code_examples/ugh.rust

11 lines
180 B
Plaintext
Raw Permalink Normal View History

fn main() {
println!("{:?}", three_squared(10));
}
fn three_squared(upto: u32) -> Vec<u32> {
(0..upto)
.filter(|i| i % 3 == 0)
.map(|i| i.pow(2))
.collect()
}