Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 55e5dc8 + a3a164a commit cbc203eCopy full SHA for cbc203e
1 file changed
Doc/tutorial/controlflow.rst
@@ -187,6 +187,13 @@ following loop, which searches for prime numbers::
187
(Yes, this is the correct code. Look closely: the ``else`` clause belongs to
188
the :keyword:`for` loop, **not** the :keyword:`if` statement.)
189
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
+
197
198
.. _tut-pass:
199
0 commit comments