`let x = 5;` is immutable; `let mut x = 5;` allows reassignment. Shadowing re-declares a name with `let`, optionally changing its type. `const` needs an explicit type and is inlined at compile time.
← Rust theorytheory 0/50 · 0%
Fundamentals · easy
2. Variables and Mutability
let bindings are immutable by default.
Check your understanding
1. What makes a binding reassignable?
2. Can shadowing change a variable's type?