Previous section To contents Next section

3.2 Loops

Loops are used to execute a piece of code more than once. Since this can be done in quite a few different ways there are four different loop control structures. They may all seem very similar, but using the right one at the right time makes the code a lot shorter and simpler.

3.2.1 while

3.2.2 for

3.2.3 do-while

3.2.4 foreach


Previous section To contents Next section