docs: clarify variables5 mutability

This commit is contained in:
Your Name 2026-06-17 19:13:58 +05:30
parent 4bab596677
commit 364015c14e
2 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@
In Rust, variables are immutable by default.
When a variable is immutable, once a value is bound to a name, you can't change that value.
You can make them mutable by adding `mut` in front of the variable name.
`variables5` is about that `mut` keyword, not shadowing.
## Further information

View File

@ -2,7 +2,8 @@ fn main() {
let number = "T-H-R-E-E"; // Don't change this line
println!("Spell a number: {number}");
// TODO: Fix the compiler error by changing the line below without renaming the variable.
// TODO: Fix the compiler error by making `number` mutable.
// This exercise is about mutability, not shadowing.
number = 3;
println!("Number plus two is: {}", number + 2);
}