0
for(int x=10; x<=40; x=x+10) { if(x == 30) { continue; } System.out.println(x); }
what if use break to stop execution..
5 Réponses
+ 1
output with continue
10
20
40
output with break
10
20
Right ?
+ 1
Sir,
The difference between continue and break is simple. Continue is used to skip a value in a loop and break is used to terminate the loop prematurely. So in your segment, currently the loop runs to completion but skips value 30. Break will terminate the loop upon reaching the value 30.
0
chokri,your answer is right
0
continue-->
loop continues
statement dont execute for that loop only
break-->
loop breaks totally
0
thank you Jeremy..😁