Curriculum Foundations Loops exercise 5 · fill-word
Loops
Exercise 2 covered Go's "for-as-while" shape by recognition. Now produce it: fill in the one keyword.
TypeScript reference
Fill the blanks →
About this theme
Go has one loop keyword: for. Three shapes:
for i := 0; i < n; i++ { ... }— classic.for cond { ... }— while-style.for { ... }— infinite, exit viabreakorreturn.
No while, no do. continue, break, and labelled breaks behave as you'd expect. The range form is its own theme (next module).