Would you please explain function of continue keyword in a little more detail ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Would you please explain function of continue keyword in a little more detail ???

21st Aug 2016, 2:14 PM
Piyush Bhatia
Piyush Bhatia - avatar
2 Answers
+ 1
When you want to bypass and not to execute the body of the loop for the iteration that passes through some condition you use the continue keyword, and so the loop continues from the next iteration. example: for x in range(10): if x % 2 == 0: continue print x now the above code would only print odd numbers because if x is even the continue keyword executes and steps the rest of the body of the loop and performs the next iteration.
21st Aug 2016, 5:06 PM
Mohammad Ghaffari
Mohammad Ghaffari - avatar
+ 1
there are some keywords like continue, goto and break. these are also known as move keywords because they transfer curser to somewhere else according to our condition given.
21st Aug 2016, 6:23 PM
Amit Gupta
Amit Gupta - avatar