Unlike let, constants cannot omit the type and their value must be a compile-time constant (it cannot depend on a runtime value).
Shadowing
Allows declaring a new variable with the same name as an existing one, hiding the original variable. Unlike mut, shadowing creates a completely new variable.
let x = 5; // First variable xlet x = x + 1; // New variable x (hides the previous one)let x = x * 2; // Another new variable x
Tip
Shadowing is useful when you need to transform a value and change its type, something mut does not allow:
let spaces = " "; // &strlet spaces = spaces.len(); // usize (same name, different type!)