0

Continue statement in C++

Guys please tell me the usage of continue statement and how it is different from break statement?

2nd Feb 2019, 6:33 AM
Manzoor Ahmed
Manzoor Ahmed - avatar
3 Antworten
+ 5
Example of continue #include <iostream> Using namespace std; Int main(); For(int I=0;I<=5;I++) If(I==3) Continue; Cout<<I<<endl; Output: 0 1 2 4 5
26th Apr 2019, 5:57 PM
Bilal Ahmed
Bilal Ahmed - avatar
+ 3
continue skips the rest of the code and starts from the top of the loop. break - breaks out of the loop or you could say exits the loop.
2nd Feb 2019, 6:42 AM
Akib
Akib - avatar
+ 3
Break completely stops the loop, whereas continue just skips the current iteration, and goes back to the top.
2nd Feb 2019, 10:04 AM
Eragon1980
Eragon1980 - avatar