Showing posts with label continue keyword. Show all posts
Showing posts with label continue keyword. Show all posts

Java- continue keyword / Chapter -8 / Flow Control


java continue keywordjava continue keyword :-



  • we can use continue keyword inside loops to skip current iteration and continue for the next iteration.


example:-
for(int i=0 ; i<10 ; i++)
{
if(i%2==0)
continue;
System.out.println(i);
}
Output is:

Java- continue keyword / Chapter -8 / Flow Control

javabychetan.blogspot.com
2. continue :-
  • we can use continue statement inside loops to skip current iteration and continue for the next iteration.
example:-
for(int i=0 ; i<10 ; i++)
{
            if(i%2==0)
            continue;
             System.out.println(i);
}
Output is:

1
3
5
7
9



  • We can use continue statement only inside a loop is we are using anywhere else, we will get compile time error saying "continue outside of loop".
example:-

Flipkart End Of Season Sale






© Copyright 2017 Javabychetan.blogspot.com