Skip to content
Cameron Purdy edited this page Apr 9, 2020 · 1 revision

The continue statement is used to unconditionally transfer control to the continuation point of a containing statement, which is referred to as the target statement. The target statement is indicated by the optional label name; otherwise, in the absence of a label, the continue statement checks its containing statement, the containing statement of its containing statement, and so on, until it finds a ForStatement, DoStatement, WhileStatement, or SwitchStatement, and selects that statement as its target statement. It is a compile-time error if the continue statement cannot identify a target statement, or if the target statement is not a ForStatement, DoStatement, WhileStatement, or SwitchStatement.

  • The continuation point for a ForStatement, DoStatement, or WhileStatement is the loop condition for the statement.
  • The continuation point for the SwitchStatement is the next SwitchBlock, or the end of the SwitchStatement if the ContinueStatement occurs in the last SwitchBlock of the SwitchStatement.

The continue statement does not complete.

Definite assignment rules:

  • The continue statement contributes the VAS from before the continue statement to the continuation point.
    ContinueStatement:
        continue Nameopt ;