@@ -541,10 +541,24 @@ evaluate to zero values.
541
541
542
542
In all other situations, expressions have to evaluate to exactly one value.
543
543
544
- The ``continue `` and ``break `` statements can only be used inside loop bodies
545
- and have to be in the same function as the loop (or both have to be at the
546
- top level). The ``continue `` and ``break `` statements cannot be used
547
- in other parts of a loop, not even when it is scoped inside a second loop's body.
544
+ A ``continue `` or ``break `` statement can only be used inside the body of a for-loop, as follows.
545
+ Consider the innermost loop that contains the statement.
546
+ The loop and the statement must be in the same function, or both must be at the top level.
547
+ The statement must be in the loop's body block;
548
+ it cannot be in the loop's initialization block or update block.
549
+ It is worth emphasizing that this restriction applies just
550
+ to the innermost loop that contains the ``continue `` or ``break `` statement:
551
+ this innermost loop, and therefore the ``continue `` or ``break `` statement,
552
+ may appear anywhere in an outer loop, possibly in an outer loop's initialization block or update block.
553
+ For example, the following is legal,
554
+ because the ``break `` occurs in the body block of the inner loop,
555
+ despite also occurring in the update block of the outer loop:
556
+
557
+ .. code-block :: yul
558
+
559
+ for {} true { for {} true {} { break } }
560
+ {
561
+ }
548
562
549
563
The condition part of the for-loop has to evaluate to exactly one value.
550
564
0 commit comments