Nearby lessons

48 of 124

C - Continue Statement

Learn the continue statement in C — it skips the rest of the current loop iteration and jumps straight to the next one.

What is continue?

continue skips the rest of the current round and jumps to the next iteration of the loop. Unlike break, the loop itself keeps running.

Trainer's Memory Trick: continue is skipping a turn in a game — the game keeps going, you just miss one round.

Continue in Action

This loop prints 1 to 5 but skips 3:

Example02
CCode Cell
1#include <stdio.h>
2void main() {
3 int i;
4 for (i = 1; i <= 5; i++) {
5 if (i == 3) continue; // skip 3
6 printf("%d ", i);
7 }
8 printf("\n");
9}
Output

1 2 4 5 
      

break vs continue

Pointbreakcontinue
EffectStops the loop completelySkips only the current round
Loop continues?No — exits the loopYes — next iteration runs
Best forLeaving early (search found)Ignoring one value
Example03
CCode Cell
1#include <stdio.h>
2void main() {
3 int i;
4 printf("break : ");
5 for (i = 1; i <= 5; i++) {
6 if (i == 3) break;
7 printf("%d ", i);
8 }
9 printf("\ncontinue: ");
10 for (i = 1; i <= 5; i++) {
11 if (i == 3) continue;
12 printf("%d ", i);
13 }
14 printf("\n");
15}
Output

break  : 1 2 
continue: 1 2 4 5 
      
📝 Key Takeaways
  • continue skips the rest of the current round
  • The loop keeps going with the next iteration
  • break ends the loop; continue only skips one round

🧠 Test Your Knowledge

1 Questions
Progress: 0 / 1