Did you know in Rust, variables are immutable by default?

Did you know in Rust, variables are immutable by default?

By default Rust variables are immutable.

In Rust, variables are immutable by default. It means once we give the variable a value, the value won't change.


The variable can be declared mutable with "mut" keyword.


e.g. let people = 10; // immutable


e.g. let mut people = 10; // mutable