Python by Swaroop C H - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

The break statement

The break statement is used to break out of a loop statement i.e. stop the execution of a looping statement, even if the loop condition has not becomeFalse or the sequence of items has been completely iterated over.

An important note is that if you break out of afor orwhile loop, any corresponding loopelse block is not executed.