+ 7

How exactly does the continue statement work?

Can anyone explain with an example?

4th Apr 2019, 9:04 AM
SWETA X
SWETA X - avatar
4 Réponses
+ 9
Thank you for the answer, Luis Sepúlveda!
4th Apr 2019, 12:35 PM
SWETA X
SWETA X - avatar
+ 6
Thanks for the answer, Omkar{status:exams;} !
4th Apr 2019, 12:52 PM
SWETA X
SWETA X - avatar
+ 4
The continue statement in C is used in loops like while, do while, and for loops.. Whenever a continue statement is encountered in code it passes control of program to next iteration of loop without executing other statements in loop.. as Luis Sepúlveda already mentioned it can be used to print even or odd numbers ...the code may can help u understand better... Happy learning 😊 https://code.sololearn.com/c9nv1F6LPxs1/?ref=app
4th Apr 2019, 12:36 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
The continue statement in a loop helps you skip over the iteration you are currently on and on to the next one. The most given example is when you want to print only even, or only odd numbers: #For numbers between 0 & 11 For x in range (12): # If x is odd if x%2==1: continue print(x) #Output: 0, 2, 4, 6, 8, 10 I wish you success!
4th Apr 2019, 9:58 AM
Luis Sepúlveda
Luis Sepúlveda - avatar