typeover
rust curriculum

Curriculum Foundations Bindings and mutability exercise 2 · mcq

Bindings and mutability

The variable is reassigned on the next line. Pick the Rust declaration that allows mutation — let alone won't compile when the next statement tries to change it.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Rust flips TypeScript's mutability default. Every binding starts immutable; you opt in to mutability with let mut. Type annotations come after the name (let x: i32 = 5), and the numeric primitives are width-specific (i32, u64, f64) instead of TS's single number. Shadowing is allowed and idiomatic because it creates a fresh binding that happens to reuse the name. Planned exercises: 1. choose immutable let. 2. choose let mut. 3. recognise type annotations. 4. distinguish mutation from shadowing. 5. fill mut. 6. fill a type annotation. 7. write a rebinding line. 8. translate several TS bindings. 9. fix a program that tries to mutate an immutable binding.