Iteration Through Loops

In a looping statement, the statements execute repeatedly till the result of a test condition remains true. A loop consists of the following parts: initialisation expression, test expression and update expression.

There are three types of looping statements: for loop, while loop and do-while loop. The for loop is a shorthand, which combines initialisation, condition and increment in one statement. Any loop statement can be used to create an infinite loop. If a loop does not contain any statement in its loop-body, it is said to be an empty loop. The while loop is an entry-controlled loop, the loop iterates when the expression evaluates to TRUE. The do-while loop is an exit-controlled loop, in which the loop body is executed first and the condition is checked at the end. A loop placed inside another loop of the same type is called a nested loop.

To Access the full content, Please Purchase