+ 1

What does continue and break exactly do and why does this code get this output? Why is 30 skipped and 10 outputed?

I don't understand why this results in 10 20 and 40. How come 30 is skipped for(int x=10; x<=40; x=x+10) { if(x == 30) { continue; } System.out.println(x); } /* Outputs 10 20 40 */ What exactly does continue do exactly fundamently?

22nd Nov 2017, 2:04 AM
Unidentified
Unidentified - avatar
2 Answers