Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 823 Bytes

dowhile.md

File metadata and controls

40 lines (27 loc) · 823 Bytes
layout title parent nav_order
default
do-while Loop
Iterative Statements
3

Java do-while Loop

The Java do-while loop is used to iterate a part of the program several times. If the number of iteration is not fixed and you must have to execute the loop at least once, it is recommended to use do-while loop.

The Java do-while loop is executed at least once because condition is checked after loop body.

Syntax:

    do{  
    //code to be executed  
    }while(condition);  

do while syntax


Java Infinitive do-while Loop

If you pass true in the do-while loop, it will be infinitive do-while loop.

Syntax:

    do{  
    //code to be executed  
    }while(true);