C Do While Syntax

C Do While Syntax. The while loop evaluates the testexpression inside the parentheses (). The while loop discussed in our previous article tests the condition before compiler enters the code block.

Loops In C And C Geeksforgeeks
Loops In C And C Geeksforgeeks from media.geeksforgeeks.org
The while loop discussed in our previous article tests the condition before compiler enters the code block. In some cases, we have to execute a body of the loop at least once even if the condition is false. Do statement while (expression) ;

It must be true for the loop to execute.

The basic format of do while loop statement is: Notice that the conditional expression appears at the end of the loop, so the statement (s) in the loop execute once before the condition is tested. If the condition returns true then the statements inside the body of while loop are executed else control comes out of the loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.


Tidak ada komentar:

Posting Komentar