1
0
Fork 0
This repository has been archived on 2023-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
lesson-go_problems/2-map-in-rust/main.rs

8 lines
192 B
Rust
Raw Normal View History

2020-11-17 03:15:02 +00:00
fn main() {
let a: Vec<u32> = (0..10).collect();
let b: Vec<(u32, u32)> = a.iter().map(|&n| (n, n.pow(2))).collect();
for (n, nn) in b {
println!("{}: {}", n, nn);
}
}