Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let mut closures = Vec::new();
- // Two closures both with the signature Fn(u8) -> ()
- let closure1 = |i: u8| println!("closure1 {}", i);
- let closure2 = |i: u8| println!("closure2 {}", i);
- closures.push(closure1);
- //closures.push(closure2)
- for closure in closures {
- closure(5);
- }
- }
Add Comment
Please, Sign In to add comment