Number in a mutable variable
We can make a variable mutable by adding the mut keyword to the declaration. In this example we use numbers as strings have addition constraints.
fn main() {
let mut num = 2;
println!("{num}");
num += 1;
println!("{num}");
}
The output:
2
3
- let
- mut