Why we use break and continue statements in python ..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

Why we use break and continue statements in python ..?

4th Mar 2018, 7:10 PM
Kala Nandini
Kala Nandini - avatar
7 Answers
+ 8
this is C, but logic is the same... https://www.sololearn.com/learn/2388/?ref=app
5th Mar 2018, 12:49 AM
Vukan
Vukan - avatar
+ 4
when the code hits continue that current iteration is skipped,break tells the loop to stop immaturely
4th Mar 2018, 7:22 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 3
- break statement is used to exit a loop; - continue statement is used to remain in a loop, but skip ahead to the next iteration.
8th Mar 2018, 2:11 AM
Tanoh Le Kadiographe
Tanoh Le Kadiographe - avatar
+ 1
The break Statement: The break statement in Python terminates the current loop and resumes execution at the next statement, just like the traditional break found in C. The continue Statement: The continue statement in Python returns the control to the beginning of the while loop. The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop. The pass Statement: The pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute.
5th Mar 2018, 12:13 PM
goluguri venkata maheshwari
goluguri venkata maheshwari - avatar
+ 1
break is used to terminate the current iteration continue is used to skip the current iteration and procede with next iteration
6th Mar 2018, 9:38 PM
Deepak Verma
Deepak Verma - avatar
0
continue overlooks, break stops
4th Mar 2018, 7:28 PM
Onasanya Tunde
Onasanya Tunde - avatar
- 3
Прив
7th Mar 2018, 11:46 AM
Geeker Play
Geeker Play - avatar