Perl Programming/Keywords/continue

Previous: connect Keywords Next: CORE

The continue keyword

edit

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

edit
  continue BLOCK
  continue

Examples

edit
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

edit
Previous: connect Keywords Next: CORE