Skip to content

Commit 4fb5242

Browse files
committed
gh-162770: Clarify the tutorial explanation of loop else
1 parent a32f37e commit 4fb5242

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎Doc/tutorial/controlflow.rst‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,9 @@ which searches for prime numbers::
240240
the ``for`` loop, **not** the ``if`` statement.)
241241

242242
One way to think of the else clause is to imagine it paired with the ``if``
243-
inside the loop. As the loop executes, it will run a sequence like
244-
if/if/if/else. The ``if`` is inside the loop, encountered a number of times. If
245-
the condition is ever true, a ``break`` will happen. If the condition is never
246-
true, the ``else`` clause outside the loop will execute.
243+
inside the loop. The ``if`` is inside the loop, encountered a number of times.
244+
If the condition is ever true, a ``break`` will happen. If the condition is
245+
never true, the ``else`` clause outside the loop will execute.
247246

248247
When used with a loop, the ``else`` clause has more in common with the ``else``
249248
clause of a :keyword:`try` statement than it does with that of ``if``

0 commit comments

Comments
 (0)