Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises/01_variables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion exercises/01_variables/variables5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}