Guided Notes
Loops
while, do-while, and for loops; break and continue; nested loops; and avoiding infinite and off-by-one errors.
Three loops
Slide 1 / 5| Loop | Checks condition | Use when |
|---|---|---|
| while (cond) { } | Before each round | Repeat while something is true |
| do { } while (cond); | After each round | Body must run at least once (menus, input) |
| for (init; cond; step) { } | Before each round | Counting a known number of times |
