🧩Loop
Code that runs the same lines again and again. It goes until told to stop.
Think of it like
Think of it like running laps of a track. You go round and round until the coach says stop.
Example
A shop's app loops over 500 orders in its list. For each one, it adds the price to the day's total.
Why it matters
Computers are good at doing the same thing many times. Loops are how you ask them to.
Definition
Common mistake
Key takeaways
- 1Repeat the same lines. One block runs many times.
- 2Needs an end. A list runs out, or a test turns false.
- 3Scales up. Ten items or ten million, same code.