do while

Navigation:  Programming language SQC > Language elements > Control elements >

do while

Previous pageReturn to chapter overviewNext page

Statement, which is usually a compound statement, is executed repeatedly as long as the value of expression remains non-zero.

The test takes place after each execution of the statement.

 

do statement while (expression)

 

Example:

 

void main()

{

    int i = 1; 

    int n = 1;

    int factorial = 10;

    

    do

    {

        n *= i;

        i++;

    } while (i <= factorial);

    

    printf("n %d",n);

}

 

Output:

 

 n 3628800