Home › C Tutorial › C break and continue
C break and continue
Leave or skip.
break exits the loop. continue skips to the next round.
Example code
#include <stdio.h>
int main() {
for (int i = 1; i <= 6; i++) {
if (i == 2) continue;
if (i == 5) break;
printf("%d ", i);
}
printf("\n");
return 0;
}