C++ Break & Continue
Break statement in C++:
The break statement is used to come out of the loop immediately and the program control resumes at the next statement following the loop.
Break statement is mainly used with in loop statement, switch and if statements.

Syntax:-
break;
Example:-
#include <iostream> using namespace std; int main(){ int i=0; for(i=1; i<=5; i++){ cout << i << endl; break; } return 0; }
Continue statement in C++:
When continue statement is used inside a loop, control directly jumps to the beginning of the loop for next iteration, skipping the execution of statements inside loop’s body for the current iteration.
Syntax:-
#include <iostream> using namespace std; int main(){ int i=0; for(i=1; i<=5; i++){ cout << i << endl; continue; } return 0; }
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.