0

here x=10,not 30.so,if condition is false,and continue should not work.but still it worked.why?

public class Program { public static void main(String[] args) { for(int x=10; x<=40; x=x+10) { if(x == 30) { continue; } System.out.println(x); } } }

1st Feb 2023, 2:40 PM
We Doru
We Doru - avatar
1 Réponse
+ 5
It works only when x = 30 Not work for x = 10, 20, 40 See output is 10 20 40 it skips to print when x = 30
1st Feb 2023, 2:51 PM
Jayakrishna 🇮🇳