What does loop mean?
A set of instructions that is repeated. A for loop repeats a known number of times; a while loop repeats as long as its condition is true.
In a lesson
To drive a square you could write forward, turn, forward, turn, forward, turn, forward, turn. Eight lines for one idea repeated four times. A loop writes the idea once and says how many times. Repeating code is called iteration, and a loop that runs a set number of times is count-controlled.
Learn it
- Taught in F2.5 Count-controlled loops: for Decisions and loops, GCSE
Used in
- F2.1 Blocks and indentation
- F2.6 Condition-controlled loops: while
- F2.7 Loop patterns
- F2.8 Project: parking sensor
- F3.2 Character codes and conversion
- F3.3 Lists: one-dimensional arrays
- F3.4 Iterating over a list
- F3.5 Two-dimensional arrays
- F3.8 Project: survey the room
- F4.3 Local and global variables
and 163 more lessons.
Do the lesson in the simulator