continue Skip the rest of an iteration
continue Skip the rest of an iteration
continue starts the nearest loop's next iteration, only in while, do, or for. for runs its step, while and do retest; switch is unaffected.
| Category | Control flow |
|---|---|
| Kind | Keyword / Statement |
| C standard | C89 / C90 |
📝 Syntax
for (...) { if (skip) continue; ... }
▶ Example
Edit the C code below and click Run; the server compiles and executes it:
Output:
even sum = 6
🏷️ Related control-flow keywords
📚 Related Tutorials
❓ FAQ
QWhat is the key difference between continue and break?
Acontinue ends only the current iteration and proceeds with the loop's subsequent steps. break terminates the entire nearest loop or switch. continue cannot be used to exit a switch.
QWhy can continue in a while loop cause an infinite loop?
AIf the statement that updates the counter or state comes after continue, it is skipped and the next condition may remain unchanged. Perform necessary updates before continue, or use a clearly structured for loop.
QDoes continue inside a switch act on the switch?
ANo. Only when the switch is inside a loop can continue skip the rest of that loop's current iteration. Without an enclosing loop, continue is not permitted.