Advertisement
cwchen

[Rust] for loop with functional programming

Aug 22nd, 2017
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.10 KB | None | 0 0
  1. fn main() {
  2.     for i in (1..).filter(|x| x % 2 == 1).take(5) {
  3.         println!("{}", i);
  4.     }
  5. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement