Closures Example
fn main() { let square = |num| num*num; let num = 3; println!("The square of {} is {}", num, square(num)); }
- Closures implement FnOnce or FnMut or Fn traits;
fn main() { let square = |num| num*num; let num = 3; println!("The square of {} is {}", num, square(num)); }