0

In the loop why did it skip 30 because of the continue statement?

here is the code public class Program { public static void main(String[] args) { int x = 1; while(x > 0) { System.out.println(x); if(x == 4) { break; } x++; } } }

31st Dec 2016, 6:47 AM
Asmi Gulati
Asmi Gulati - avatar
2 Antworten
+ 2
Could you please include the code you're questioning about?
31st Dec 2016, 6:53 AM
Dao
Dao - avatar
+ 2
The code you've included has no "continue" statement, only a break statement. The code you've added to the question should print x, until the if statement occurs, breaking you out of the loop.
31st Dec 2016, 7:18 AM
Dao
Dao - avatar