jayber f9a4ff3b82 feat: added closures exercises in closure directory
Closures as a separate exercises appeared to be missing, so I added some. Have placed them in the watch order after functions, which seemed reasonable.
2022-05-30 21:47:47 +01:00

24 lines
481 B
Rust

// closure3.rs
// What is the difference between a closure and a function, part II? Can you get this code
// to compile?
// Execute `rustlings hint closures3` for hints!
// I AM NOT DONE
fn main() {
let my_name = String::from("Lim Lady");
fn actual() {
println!("my name is: {}", my_name);
}
let actual_fn = actual;
let closure = || {
println!("my name is: {}", my_name);
};
println!("Who am I?");
actual_fn();
closure();
}