rustlings/solutions/01_variables/variables4.rs

10 lines
234 B
Rust
Raw Permalink Normal View History

2024-05-21 00:47:57 +01:00
fn main() {
// In Rust, variables are immutable by default.
// Adding the `mut` keyword after `let` makes the declared variable mutable.
let mut x = 3;
println!("Number {x}");
2024-05-21 01:43:18 +01:00
x = 5;
2024-05-21 00:47:57 +01:00
println!("Number {x}");
}