| layout | default |
|---|---|
| title | while Loop |
| parent | Iterative Statements |
| nav_order | 2 |
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
}
If you pass true in the while loop, it will be infinitive while loop.
Syntax:
while(true){
//code to be executed
}
