Home › C++ Tutorial › C++ break and continue
C++ break and continue
Stop or skip.
break leaves the loop, continue jumps to the next round.
Example code
#include <iostream>
using namespace std;
int main() {
for (int i = 1; i <= 6; i++) {
if (i == 2) continue;
if (i == 5) break;
cout << i << " ";
}
cout << endl;
return 0;
}