What are Loops?
A loop in a program is a sequence of statements which is only specified once but may be executed several times in succession. This is in contrast to the normal execution of a program which tends to follow a sequential flow of control. Statement in a body of a loop is executed for a specified number of times, until some condition is met or for each collection of items. The Java provides three repetition statements (also called looping statements) that enables programs to perform statements repeatedly as long as a condition (called the loop-continuation condition) remains true. The repetition statements are Even though the control structures are different, a program written using a loop construct can easily be translated into any of the other forms. Depending on the situation, we may favor a loop construct which is more efficient for a particular situation over the other. |
Loops while do...while for Control Structure Loop Design Methodology Common Loop Errors |
Fook Yuen Sin - Team 1 |