What is the use of break statement in python?
Answers
Answered by
0
Answer:
It terminates the current loop and resumes execution at the next statement, just like the traditional break statement in C.
The most common use for break is when some external condition is triggered requiring a hasty exit from a loop. The break statement can be used in both while and for loops.
If you are using nested loops, the break statement stops the execution of the innermost loop and start executing the next line of code after the block.
Similar questions
Science,
4 months ago
English,
4 months ago
World Languages,
4 months ago
Math,
8 months ago
History,
8 months ago
Math,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago