Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 594 Bytes

File metadata and controls

33 lines (24 loc) · 594 Bytes
layout default
title while Loop
parent Iterative Statements
nav_order 2

While Loop

The Java while loop is used to iterate a part of the program several times. If the number of iteration is not fixed, it is recommended to use while loop.

Syntax:

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

while loop syntax


Java Infinitive While Loop

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

Syntax:

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