From 4fb524281af64136aa920fea6222aed5b7bd04b4 Mon Sep 17 00:00:00 2001 From: Chua Yu Jien <178788739+CYJienn@users.noreply.github.com> Date: Sun, 29 Nov 2026 03:26:57 +0800 Subject: [PATCH] gh-162770: Clarify the tutorial explanation of loop else --- Doc/tutorial/controlflow.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index c397ed4f218b6a3..ce3cf1902324be9 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -240,10 +240,9 @@ which searches for prime numbers:: the ``for`` loop, **not** the ``if`` statement.) One way to think of the else clause is to imagine it paired with the ``if`` -inside the loop. As the loop executes, it will run a sequence like -if/if/if/else. The ``if`` is inside the loop, encountered a number of times. If -the condition is ever true, a ``break`` will happen. If the condition is never -true, the ``else`` clause outside the loop will execute. +inside the loop. The ``if`` is inside the loop, encountered a number of times. +If the condition is ever true, a ``break`` will happen. If the condition is +never true, the ``else`` clause outside the loop will execute. When used with a loop, the ``else`` clause has more in common with the ``else`` clause of a :keyword:`try` statement than it does with that of ``if``