Labs ICT
๐ŸŽ“ SIWES/IT Login

Break & Continue

1 min read | C++ Tutorial
๐ŸŽ“

Doing SIWES / IT attachment?

Get a structured training programme, a supervised digital logbook, and a completion certificate with LabsICT SIWES / IT.

Explore SIWES / IT Training

break and continue

Two jump statements give you finer control inside loops.

break exits the loop immediately. Execution jumps to the line after the loop.

continue skips the rest of the current iteration and moves to the next one.

for (int i = 1; i <= 10; i++) {
  if (i == 5) {
    break;
  }
  if (i % 2 == 0) {
    continue;
  }
  cout << i << "\n";
}

In this example, continue skips even numbers, and break stops the loop entirely when i reaches 5. The output is 1 and 3.

๐Ÿงช Quick Quiz

What does the continue statement do in a loop?