Curriculum Basics Variables (const and var) exercise 4 · fill-word
Variables (const and var)
Fill the missing keyword. The variable will be reassigned later
in the program (you can see the += 1 line), so it needs the
mutable form — not the const default.
TypeScript reference
Fill the blanks →
About this theme
Zig defaults the other way from TypeScript. const is the default reflex; var is the explicit opt-in when you need to reassign. Type annotations come AFTER the name (var x: i32 = 5), not before, and they're optional when the literal disambiguates. Shadowing across scopes is allowed; redeclaring in the same scope is a compile error.