1
Reply

What is Entry Controlled Loop vs Exit Controlled Loop?

Vijay Kumari

Vijay Kumari

5y
19.5k
0
Reply

    Entry Controlled Loop vs Exit Controlled Loop

    • In an entry controlled loop, the test condition is checked first followed by loop body, whereas in an exit controlled loop, the loop body is executed first followed by the test condition
    • In an entry controlled loop, if the test condition is false, the loop body will not be executed, whereas in exit controlled loop, if the test condition is false, the loop body will be executed once.
    • Entry controlled loops are used when checking of test condition is mandatory before executing loop body, whereas exit controlled is used when checking of test condition is mandatory after executing.
    • For loop, Foreach loop and while loops are examples of entry controlled loops, whereas do-while loop is an example of exit controlled loop.

    For a detailed tutorial on Java Control and Loop Statements please visit https://www.c-sharpcorner.com/article/java-loops-and-control-statements/