Opening Hours :7AM to 9PM
Un Conditional Statements allows you to direct the program's flow to another part of your program without evaluating conditions.
These are classified into following types.
1. continue
2. break
'continue' statement is used to continue the loop( It skip the one iteration if the condition is true).
if(condition) { continue; }
public class Main { public static void main(String args[]) { int x; for(x=1;x<=10;x++) { if(x%2!=0)continue; System.out.println(x); } } }
'break' statement is used to break the loop.
if(condition) { break; }
public class Main { public static void main(String args[]) { int x; for(x=1;x<=10;x++) { if(x%2==0 && x%3==0) { break; } System.out.println(x); } } }