break and continue(C language) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

break and continue(C language)

can anyone post difference b/w break and continue with good example

26th Sep 2019, 9:38 AM
Reiner
Reiner - avatar
4 Answers
+ 4
break - to end a whole current loop. continue - to go to the next loop. For example, when : int i=0; while(i<10) { i++; if(i%3==0) { break; } printf("%d", i); } //Output: 12 int i=0; while(i<10) { i++; if(i%3==0) { continue; } printf("%d", i); } //Output: 124578
26th Sep 2019, 10:05 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Break go out of a loop orcsome section when read by the compiler,continue go over the next iteration.
26th Sep 2019, 10:09 AM
KfirWe
KfirWe - avatar
+ 1
26th Sep 2019, 3:13 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
so it breaks while loop but not if condition right???
26th Sep 2019, 12:25 PM
Reiner
Reiner - avatar