Continue Statement - C++ Control Structures
Using Continue Statement in C++?
How to skip current iteration of a loop?
is used to skip the code after the "continue" and go ahead with the next iteration of a loop.
Difference between "break" and "continue":
The "break" statement terminates the current statement, but a "continue" statement terminates the current iteration of a loop by not executing statements after it.
cout << "Enter a integer::" << '\n';
cin >> i;
cout << "Value of i is::" << i <i--;
cout << "SKIPPED\n";
cout << "Exited Loop" << '\n' ;
Enter a Integer::3
Value of i is:: 3
Value of i is:: 1
In the above example only when the value of i is 2 the "cout" statement with message "skipped" is executed, and the "cout" statement with the message is skipped.