A static foreach statement (and only that, not a foreach statement over a compile-time sequence) should permit static break and static continue statements, possibly labeled to discriminate which static foreach is meant. The unlabeled version is always admissible and refers to the innermost static foreach. Due to the static keyword, conflation with a non-static loop or other construct is unlikely.
In every loop iteration, it generates code. Essentially, the loop body is copied and the iteration variable replaced by its value. If it contains any static break or static continue that refer to the current loop, any static foreach and static if declarations must be be handled. If any static break or static continue remain, the first takes precedent. If it is a static break, anything after it must be discarded and the loop must not generate another instantiation. If it’s a static continue, anything after it must be discarded before the next loop iteration.
(Anything said for static foreach also applies to static foreach_reverse.)
A
static foreachstatement (and only that, not aforeachstatement over a compile-time sequence) should permitstatic breakandstatic continuestatements, possibly labeled to discriminate whichstatic foreachis meant. The unlabeled version is always admissible and refers to the innermoststatic foreach. Due to thestatickeyword, conflation with a non-staticloop or other construct is unlikely.In every loop iteration, it generates code. Essentially, the loop body is copied and the iteration variable replaced by its value. If it contains any
static breakorstatic continuethat refer to the current loop, anystatic foreachandstatic ifdeclarations must be be handled. If anystatic breakorstatic continueremain, the first takes precedent. If it is astatic break, anything after it must be discarded and the loop must not generate another instantiation. If it’s astatic continue, anything after it must be discarded before the next loop iteration.(Anything said for
static foreachalso applies tostatic foreach_reverse.)