12.7 continue statement

2010-05-23

ContinueStatement :
continue [no LineTerminator here] Identifier(opt) ;

A Program is considered to be syntactically incorrect when a continue statement occurs that's not nested (somehow) within a IterationStatement. Functions act as a boundary here. It's also incorrect when the label for a continue statement does not occur in the enclosing IterationStatement (again, functions act as boundaries).

Code: (Meta Ecma)
function evaluate(continue ;) {
return Completion('continue', undefined, undefined);
}


Code: (Meta Ecma)
function evaluate(continue Identifier ;) {
return Completion('continue', undefined, Identifier);
}

On the meta level, continue acts like break except break may also occur in a switch and break to a label in the entire Statement. Other mechanisms make it so break ends an iteration while continue initiates the next iteration.