- continue BLOCK
- continue
-
When followed by a BLOCK,
continueis actually a flow control statement rather than a function. If there is acontinueBLOCK attached to a BLOCK (typically in awhileorforeach), it is always executed just before the conditional is about to be evaluated again, just like the third part of aforloop in C. Thus it can be used to increment a loop variable, even when the loop has been continued via the next statement (which is similar to the Ccontinuestatement).BLOCK が引き続く場合、
continueは実際には関数ではなく、 実行制御文です。continueBLOCK が BLOCK (典型的にはwhileまたはforeachの中)にあると、これは条件文が再評価される直前に常に実行されます; これは C におけるforループの 3 番目の部分と同様です。 従って、これは next 文 (これは C のcontinue文と似ています) を使って ループが繰り返されるときでもループ変数を増やしたいときに使えます。last, next, or redo may appear within a
continueblock; last and redo behave as if they had been executed within the main block. So will next, but since it will execute acontinueblock, 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 to the top to re-check EXPR } ### last always comes hereOmitting the
continuesection is equivalent to using an empty one, logically enough, so next goes directly back to check the condition at the top of the loop.continue節を省略するのは、空の節を指定したのと同じで、 論理的には十分なので、この場合、next は直接ループ先頭の 条件チェックに戻ります。When there is no BLOCK,
continueis a function that falls through the currentwhenordefaultblock instead of iterating a dynamically enclosingforeachor exiting a lexically enclosinggiven. In Perl 5.14 and earlier, this form ofcontinuewas 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 を 参照してください。