C++ Continue Statement

Continue statement provides a way to instantly jump to the beginning of the loop for the next iteration. After continue statement, the control is immediately shifted to the beginning of the loop by ignoring followed statements. 

It is mostly used within for, while, do-while loops or switch statements.

Syntax: continue statement:

Continue;

Flow Chart: Continue Statement

Ecample: Continue Statement

//continue statement in C++
#include <iostream>  
using namespace std;  
int main()  
{  
    for (int i = 1; i <= 10; i++) {
        if (i == 5) {
            continue;
        }
        cout << i << endl;
    }

return 0;
} 

Output

1
2
3
4
6
7
8
9
10