+ 1
Difference between Break and continue statement?
5 Respostas
+ 9
Break: Break keyword is used to transfer control of loop outside the loop.
For example:-
for(i=0;i<5;i++)
{
if(i==3)
break;
else printf("%d",i);
}
It will print number from 0 to 2 and when value of i will be 3 then loop terminates.
Continue: continue keyword is used to skip one number for example:-
for(i=0;i<5;i++)
{
if(i==3)
continue;
else printf("%d",i);
}
It will print number from 0 to 5 except 3.
+ 4
Check this out.
https://www.sololearn.com/learn/CSharp/2600/
+ 4
Break stops a for loop, continue goes to the next iteration in a for loop,
0
in ruby, continue doesnt exist, but next does and it does the exact same thing as continue 😁