Immutable integers are copies
- Only the original is mutable, the copy is not
fn main() {
let mut a = 23;
println!("{a}");
let b = a;
println!("{b}");
a += 1;
println!("{a}");
println!("{b}");
}
23
23
24
23
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
fn main() {
let mut a = 23;
println!("{a}");
let b = a;
println!("{b}");
a += 1;
println!("{a}");
println!("{b}");
}
23
23
24
23