Quick actions

cmd+k|ctrl+k

Navigation

Languages

Loops / Loop Control statements: break and continue / Essential C++

Snippet info

Language

Cpp

Visibility

public

Author

kkowalczyk

Created

2019-03-27T06:54:19Z

Updated

2019-03-27T06:54:19Z

#include <iostream>
using namespace std;

auto main() -> int
{
    for (int i = 0; i < 10; i++)
    {
        if (i == 4)
            break; // this will immediately exit our loop
        std::cout << i << '\n';
    }
}
INFO