Guest User

Untitled

a guest
Dec 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. fn main() {
  2. let mut closures = Vec::new();
  3.  
  4. // Two closures both with the signature Fn(u8) -> ()
  5. let closure1 = |i: u8| println!("closure1 {}", i);
  6. let closure2 = |i: u8| println!("closure2 {}", i);
  7.  
  8. closures.push(closure1);
  9. //closures.push(closure2)
  10.  
  11. for closure in closures {
  12. closure(5);
  13. }
  14. }
Add Comment
Please, Sign In to add comment