+ 8
Why we use break and continue statements in python ..?
7 odpowiedzi
+ 8
this is C, but logic is the same...
https://www.sololearn.com/learn/2388/?ref=app
+ 4
when the code hits continue that current iteration is skipped,break tells the loop to stop immaturely
+ 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.
+ 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.
+ 1
break is used to terminate the current iteration continue is used to skip the current iteration and procede with next iteration
0
continue overlooks, break stops
- 3
Прив