A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-13.rs
1fnmain(){
2letx=10;
3letby_ref=||x;
4letby_val=move||x;
5println!("{} {}",by_ref(),by_val());
6}
Closures
Answer & explanation
Console output
10 10
Why
The first closure borrows `x` by reference; the second `move` closure copies it (since `i32` is `Copy`). With no mutation of `x`, both read the same value 10. For `Copy` types the by-ref vs by-value distinction does not change the observed result here.