< Perl Programming < Keywords

The continue keyword

continue is a flow-control statement, if followed by a BLOCK. In a BLOCK or BLOCK, each time before the conditional is to be evaluated, contents of BLOCK are executed. So, it can be used to increment a loop variable even after a next statement (that resembles to the continue statement of C and other languages).

The BLOCK may contain last, next, or redo commands, where last and redo show the same behaviour as if they had been called in the main block.

Syntax

  continue BLOCK
  continue

Examples

while (EXPRESSION) {
   ### possible redo
   do_something;
} continue {
   ### possible next
   do_something_else;
   # go back the top to re-check the EXPRESSION
}
### possible last call

See also

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.