What are the entry controlled and exit controlled loops?

Depending on the position of the control statement in the loop, a control structure can be classified into two types; entry controlled and exit controlled. They are described below.

Read More: 3 Differences between entry and exit controlled loops with examples.

Entry controlled loop:

The types of loop where the test condition is stated before the body of the loop, are known as the entry controlled loop. So in the case of an

entry controlled loop, the condition is tested before the execution of the loop. If the test condition is true, then the loop gets the execution, otherwise not. For example, the for loop is an entry controlled loop. In the given figure, the structure of an entry controlled loop is shown.

Exit controlled loop :

The types of loop where the test condition is stated at the end of the body of the loop, are know as the exit controlled loops. So, in the case of the exit controlled loops, the body of the loop gets execution without testing the given condition for the first time. Then the condition is tested. If it comes true, then the loop gets another execution and continues till the result of the test condition is not false. For example, the do statement or the do....while loop is an exit controlled loop. The structure of an exit controlled loop is given in the given figure.

Next Read:

Recommended Recommends


Contact Us