Labs ICT
โญ Pro Login

Break & Continue

1 min read | C++ Tutorial
โญ

Want the full learning experience?

Get structured courses, certificates, projects, and instructor support with LabsICT Pro.

Explore Pro Courses

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?