Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

shadowing

Declaring a new variable with the same name as an old one.

Shadowing declares a new binding with an existing name, hiding the old one; the new binding may have a different type.

Examples

  • let price = 20; let price = price * 2; let price = price + 5; ends with price equal to 45; each let makes a new variable.

  • let tag = tag.len(); reuses the name tag for a usize, which let mut could not do.

Read the full section →