Continue to the next iteration of for loop - C++ Statement

C++ examples for Statement:continue

Description

Continue to the next iteration of for loop

Demo Code

#include <iostream>

using namespace std;

int main()/*from w  w  w  . ja va  2 s  .c om*/
{
    for (int i=0; i<10; i++)
    {
        cout << i << " ";
        if (i == 5)
        {
            cout << endl;
            continue;
        }
        cout << i * 2 << endl;
    }

    cout << "All Finished!" << endl;

    return 0;
}

Result


Related Tutorials