For loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For loops

I can't understand what's the purpose of continue; and how it helps us

30th Mar 2024, 8:47 AM
Giannis Kallergis
Giannis Kallergis - avatar
2 Answers
+ 3
Giannis Kallergis the continue statement is a shortcut to the next iteration of the loop, skipping past the remaining statements of the loop and going back to its beginning. There are few, if any, situations where it is really needed. In my professional experience I have never seen it used in real code, and it has never entered into my own code. The only statement that is even more rare than continue is the goto statement.
30th Mar 2024, 2:56 PM
Brian
Brian - avatar
+ 2
It ignores the following instructions in a for loop, and jumps to the next step.
30th Mar 2024, 10:51 AM
🇮🇱 Radin Masiha 🇮🇱
🇮🇱 Radin Masiha 🇮🇱 - avatar