Skip to main content

Difference Between While Loop & Do While Loop

 

 While Loop

 Do While Loop

 Test condition first before execution.

 Test condition after execution.

It does not execute if condition false first. 

It execute once if condition false. 

 While loop dose not terminate by semicolon.

Do While loop is terminate by semicolon.

 Syntax :
    Initialization
 While (Test condition)
    {statement;
        increment/decrement;
                }    
 Syntax:
        Initialization
      Do{statement;
            increment/decrement;
                }
       While (Test condition);
                }

Comments

Popular posts from this blog

BCA mathematics -I (Unit I Set)

 .

BCA Mathematics -I (Unit I Complex Number)

 .

BCA Mathematics -I (Unit I Natural Number)

.