Given the code below:
let x = 5;
let y = x;
println!("{}", x);
As far as I have been reading, I learned that the above code would end up in error as the value of x
has been moved to y
. But it doesn't work that way. I have tried the above code with integers and strings, it just works.