+ 5
What's the difference between put keyword "continue" in if statement and loop ?
What's the difference between put keyword "continue" in if statement and loop ?
1 Antwort
+ 10
"continue" skips the current iteration of a loop. You cannot use "continue" in if-statement if there is no loop.
for(int i = 1; i<=5; i++){
if(i==3) continue;
System.out.print(i);
}
Output: 1245 (3 has been skipped here)