Skip to content

Latest commit

 

History

History
24 lines (19 loc) · 449 Bytes

Unit-08.md

File metadata and controls

24 lines (19 loc) · 449 Bytes

Break / Continue 

break: a break keyword, breaks out of the switch block.

continue: The continue statement breaks one iteration (in the loop), if a specified condition occurs, and continues with the next iteration in the loop.

// Break

for (i = 0; i < 10; i++) {
  if (i == 4) {
    break;
  }
  printf("%d\n", i);
}

// Continue
for (i = 0; i < 10; i++) {
  if (i == 4) {
    continue;
  }
  printf("%d\n", i);
}