Level 1 · Foundations
Module 4: Repetition and Problem-Solving
For loops
Write for loops with a start, condition and update, count up and down, step by more than one, and loop over the indexes of a string or array.
Lesson 17
While and do-while loops
Use while loops when the number of iterations is unknown, use do...while when the body must run at least once, and prevent infinite loops.
Lesson 18
Break and continue
Use break to leave a loop early and continue to skip one iteration, and decide when a flag or condition is clearer.
Lesson 19
Nested loops and patterns
Write nested loops, predict how many times the inner body runs, build text patterns and grids, and recognise when nesting becomes slow.
Lesson 20
Solving problems with iteration
Solve problems with the accumulator, counter, maximum/minimum and search patterns, plan a loop before writing it, and test it with edge cases.
Module mastery assessment
Eight questions and a practical task covering Lessons 16 to 20: for, while and do...while loops, break and continue, nested loops and loop patterns.