Hello,
In the following code when a redeclaration happened, then n
is a new variable in the memory?
fn main() {
let mut n = 1; // Declaration
print!("{}", n);
n = 2;
print!(" {}", n);
let n = 3.14; // Redeclaration
print!(" {}", n);
}
The old variable is no longer accessible and hasn’t been destroyed?
Thank you.