RosettaCodeData/Task/Closures-Value-capture/Rust/closures-value-capture.rust

5 lines
116 B
Text
Raw Permalink Normal View History

2015-02-20 09:02:09 -05:00
fn main() {
2015-11-18 06:14:39 +00:00
let fs: Vec<_> = (0..10).map(|i| {move || i*i} ).collect();
println!("7th val: {}", fs[7]());
2015-02-20 09:02:09 -05:00
}