Iteration: loops, break and continue
Computer Studies · Grade 10 · about 40 minutes
Repeating steps with while and for loops, the danger of the infinite loop, and controlling loops with break and continue.
Sign in to read this lesson
Lessons are for learners and teachers with an account. Browsing the curriculum — subjects, strands and what each sub-strand covers — stays open to everyone.
- 7 sections of explanation, worked examples and diagrams
- 1 practice task with hints and worked answers
- A quiz that marks itself as you go
- Your progress kept across every subject you take
Other lessons in this sub-strand
- Selection: making decisions
- Iteration: loops, break and continue
- Sequence: steps in order
- How Boolean expressions are used in control
- Compound Boolean expressions in real rules
- The simple if: one optional path
- if-else: two paths, one of them always runs
- if-elif-else: several bands, first True wins
- Nested if: a decision inside a decision
- Flowcharts for selection
- while loops: repeat until something happens
- for loops and range: a known number of times
- Nested loops: a loop inside a loop
- break: leave the loop immediately
- continue: skip this round, not the loop
- Choosing the right control structure
- Combining sequence, selection and iteration