Curriculum Basics Variables (const and var)
Variables (const and var)
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.
9 ready
01
pick one TypeScript declares a mutable binding with let and the type
02
pick one TypeScript's const and Zig's const look identical, but
03
pick one TypeScript's string is a primitive built-in. Zig has no
04
fill blanksFill the missing keyword. The variable will be reassigned later
05
fill blanksFill the missing TYPE annotation. The variable holds a Boolean
06
type one lineType the missing Zig line. The program declares a constant
07
type one lineType the missing Zig line. The program declares a MUTABLE
08
write a programWrite a complete Zig program that:
09
write a programWrite a complete Zig program that: