int i = 0;
while (i < 10) {
if (i == 4) {
i++; //why do I need this line ?
continue;
}
System.out.println(i);
i++;
}
int i=0;
while(i<10){
if(i%2==0){
i++;
continue;// If it's pair we return to the while
}
System.out.println(i);// If is not we print it.
i++;
}
for (int i = 0; i < 10; i++) {
if (i == 4) {
continue;
}
System.out.println(i);
}
class Main {
public static void main(String[] args) {
// for loop
for (int i = 1; i <= 10; ++i) {
// if value of i is between 4 and 9
// continue is executed
if (i > 4 && i < 9) {
continue;
}
System.out.println(i);
}
}
}
int number = 4;
int finalnum = 20;
while(number <= finalnum){
number++;
if(number %2 != 0){//Each odd number restarts the loop
continue;
}
System.out.println("Even Number!: "+ number);
}
}//EOM