- continue BLOCK
- continue
-
When followed by a BLOCK,
continue
is actually a flow control statement rather than a function. If there is acontinue
BLOCK attached to a BLOCK (typically in awhile
orforeach
), it is always executed just before the conditional is about to be evaluated again, just like the third part of afor
loop in C. Thus it can be used to increment a loop variable, even when the loop has been continued via thenext
statement (which is similar to the Ccontinue
statement).BLOCK が引き続く場合、
continue
は実際には関数ではなく、 実行制御文です。continue
BLOCK が BLOCK (典型的にはwhile
またはforeach
の中)にあると、これは条件文が再評価される直前に常に実行されます; これは C におけるfor
ループの 3 番目の部分と同様です。 従って、これはnext
文 (これは C のcontinue
文と似ています) を使って ループが繰り返されるときでもループ変数を増やしたいときに使えます。last
,next
, orredo
may appear within acontinue
block;last
andredo
behave as if they had been executed within the main block. So willnext
, but since it will execute acontinue
block, it may be more entertaining.last
,next
,redo
がcontinue
ブロック内に現れる可能性があります;last
とredo
はメインブロックの中で 実行されたのと同じように振舞います。next
の場合は、continue
ブロックを 実行することになるので、より面白いことになります。while (EXPR) { ### redo always comes here do_something; } continue { ### next always comes here do_something_else; # then back the top to re-check EXPR } ### last always comes here
Omitting the
continue
section is equivalent to using an empty one, logically enough, sonext
goes directly back to check the condition at the top of the loop.continue
節を省略するのは、空の節を指定したのと同じで、 論理的には十分なので、この場合、next
は直接ループ先頭の 条件チェックに戻ります。When there is no BLOCK,
continue
is a function that falls through the currentwhen
ordefault
block instead of iterating a dynamically enclosingforeach
or exiting a lexically enclosinggiven
. In Perl 5.14 and earlier, this form ofcontinue
was only available when the"switch"
feature was enabled. See feature and "Switch Statements" in perlsyn for more information.BLOCK がなければ、
continue
は動的に囲まれたforeach
や レキシカルに囲まれたgiven
で反復するのではなく、現在のwhen
またはdefault
のブロックを通り抜けるための文です。 Perl 5.14 以前では、この形式のcontinue
は"switch"
機能 が有効の場合にのみ 利用可能です。 さらなる情報については feature と "Switch Statements" in perlsyn を 参照してください。