Tsallaka zuwa abun ciki
Justice Tech School

break and continue

break leaves a loop and continue skips a round.

Example
#include <iostream>

int main() {
  for (int i = 1; i <= 6; i++) {
    if (i == 2) continue;
    if (i == 5) break;
    std::cout << i << " ";
  }
  std::cout << "\n";
  return 0;
}

Result

1 3 4 

Exercise

Skip a round.

;

Quiz Test

What does break do?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.