+ 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 ?

3rd Aug 2017, 2:32 PM
Corey
Corey - avatar
1 Resposta
+ 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)
3rd Aug 2017, 3:20 PM
Shamima Yasmin
Shamima Yasmin - avatar