Statements: Continue

A continue statement terminates the execution of the innermost enclosing do, for, foreach, or while statement. For example:

<?hh // strict

namespace Hack\UserDocumentation\Statements\Continue\Examples\OddValues;

function main(): void {
  for ($i = 1; $i <= 10; ++$i) {
    if (($i % 2) === 0)
    echo "$i is odd\n";
1 is odd
3 is odd
5 is odd
7 is odd
9 is odd

Although a continue statement must not attempt to break out of a finally block, a continue statement can terminate a loop that is fully contained within a finally block.