Skip to content

Commit 24be1a9

Browse files
committed
remove mention of unrolling the loop
1 parent 5b4cf1c commit 24be1a9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/tutorial/controlflow.rst

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

239239
One way to think of the else clause is to imagine it paired with the ``if``
240-
inside the loop. If you conceptually unroll the loop, you have an if/if/if/else
241-
structure. The ``if`` is inside the loop, executing a ``break``, and the
242-
``else`` is the else clause outside the loop.
240+
inside the loop. As the loop executes, it will run a sequence like
241+
if/if/if/else. The ``if`` is inside the loop, encountered a number of times. If
242+
the condition is ever true, a ``break`` will happen. If the condition is never
243+
true, the ``else`` clause outside the loop will execute.
243244

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

0 commit comments

Comments
 (0)