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.

CategoryControl flow
KindKeyword / Statement
C standardC89 / 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 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.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

Content reviewed by MOTO · Found an error? Report it

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏