Exit Control Loop -Do while

 Exit Control Loop 

Do-while loop is known to be exit control loop. as it's name suggests it control the loops while exiting. unlike for and while loops which are entry control loops. 


Do - while :

 even if the condition is true/false the block of code is executed at least once and the then the condition is checked, if the condition does not meet it loops till the condition is met.

Before talking about Do-while loop one has to know about for and while loop.

In for or while loop the condition is checked first before looping. but in do while condition is checked only after looping 1 time and if the condition doesn't met the loop is initiated again till the condition met.

syntax for do-while loop:     

Do

     {

                 block_code

}

while (Condition);

remember ; is important

Comments