Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbc203e

Browse files
committed
Merge from 3.2
2 parents 55e5dc8 + a3a164a commit cbc203e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Doc/tutorial/controlflow.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ following loop, which searches for prime numbers::
187187
(Yes, this is the correct code. Look closely: the ``else`` clause belongs to
188188
the :keyword:`for` loop, **not** the :keyword:`if` statement.)
189189

190+
When used with a loop, the ``else`` clause has more in common with the
191+
``else`` clause of a :keyword:`try` statement than it does that of
192+
:keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs
193+
when no exception occurs, and a loop's ``else`` clause runs when no ``break``
194+
occurs. For more on the :keyword:`try` statement and exceptions, see
195+
:ref:`tut-handling`.
196+
190197

191198
.. _tut-pass:
192199

0 commit comments

Comments
 (0)