Break out of the loop Break/Continue
for (int i = 0; i < 10; i++) {
if (i == 4) {
break;
}
printf("%d\n", i);
}
break out of the loop when i
is equal to 4
for (int i = 0; i < 10; i++) {
if (i == 4) {
continue;
}
printf("%d\n", i);
}
Example to skip the value of 4
Comments