Movatterモバイル変換


[0]ホーム

URL:


functions /continue
(source,CPAN)
You are viewing the version of this documentation from Perl 5.10.0.View the latest version
#continue BLOCK
#continue

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).

last,next, orredo may appear within acontinue block.last andredo will 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.

    while (EXPR) {### redo always comes heredo_something;    } continue {### next always comes heredo_something_else;# then back the top to re-check EXPR    }    ### last always comes here

Omitting thecontinue section is semantically equivalent to using an empty one, logically enough. In that case,next goes directly back to check the condition at the top of the loop.

If the "switch" feature is enabled,continue is also a function that will break out of the currentwhen ordefault block, and fall through to the next case. Seefeature and"Switch statements" in perlsyn for more information.

Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.

The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.


[8]ページ先頭

©2009-2026 Movatter.jp