Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The loop statement defines an infinite loop.

As an example, the following loop would never end:

10.2.1break

Using the break keyword, we may leave the loop at any moment:

()

The break keyword allows us to return a value:

15

see solution

10.2.2continue

Using the continue keyword, we can also skip the current step and go to the next:

()

10.2.3Nested loops

Exiting from nested loops is best done using a label:

(1, 7)