If my question is very basic, please dont mind.
I am trying to learn Rust.
Right now I am at data types where I came across
const, which are interesting.
The part I didnt understand is, if by default all variables are immutable unless there is
let mut, and those variables are can not be changed in general way but with
shadow they can be changed then what is the reason behind having immutable behaviour ?
let x: u32 = 10; // immutable for now let x = 20 ; // not any more. let mut y: u32 = 20; //mutable y = 30; // no errors expected
except an an extra
let, I see x and y as are same things. What is the advantage of defining x as immutable at initial step ?
Please help me understand.