🚀 Question 201: What does this program print? 🦀 fn main() { let mut s = String::from("rust"); { let r = &mut s; r.push_str("ace"); } println!("{}", s); }
3
0
12
2K
2
@code_rusty Before you answer (wrong) - remember in Rust, even a bare '{ }' creates a new scope, with all its consequences. Thing I dearly miss in other languages.
@code_rusty surely s gets moved to the inner scope because you're creating the reference inside, and then you can't access it in the println