-->
Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Monday, July 17, 2017

While Loop

While loop
Just like the for loop, while loop is also used to iterate over a piece of code multiple times until a particular condition is met.If you don't know the number of repitition that is to be done in advance then you should use this loop.

Syntax:

initialization    
while(condition){  
    //code to be executed
    //update statement
    }  

Example:

    public class WhileLoop {  
    public static void main(String[] args) {  
        int i=1;  
        while(i<=10){  
            System.out.println(i);  
        i++;  
        }  
    }  
    }  
Output:
1
2
3
4
5
6
7
8
9
10
 

No comments:

Post a Comment