Curriculum Basics while and for exercise 5 · fill-word
while and for
Fill the missing keyword for the iteration loop. The construct
is the same as TypeScript's for...of keyword — three letters,
lowercase.
TypeScript reference
Fill the blanks →
About this theme
Zig has while (cond) { ... } for condition-driven loops and for (slice) |item| { ... } for iteration. The C-style three-clause for (init; cond; step) is gone — its replacement is while (cond) : (step) { ... } (note the colon-continuation syntax for the step expression). The TS for...of reflex maps directly to Zig's for (...) |item|.