Repeating a set of actions until a certain condition (predicate) fails is the job of programming loops;
loops can take different forms, but they all satisfy this basic behavior.
A loop includes:
Each time the loop block executes, that’s called an iteration. See Design Pattern - (Iterator|Cursor)
The only practical difference between these loops is whether the conditional is tested:
- before the first iteration (while)
- or after the first iteration (do.. while).
Loop Control Statement
- The break statement stop a loop.
- The continue statement goes to the next iteration without running the code below it.