A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-36.rs
1fnmain(){
2letmutc=0;
3letmutbump=||{c+=2;};
4bump();
5bump();
6bump();
7println!("{}",c);
8}
Closures
Answer & explanation
Console output
6
Why
Because the closure mutates `c`, Rust captures it by unique (mutable) reference, which makes the closure `FnMut` and requires the `mut` binding. Each call adds 2 to the same `c`; after three calls `c` is 6. The mutations persist on the original variable.