-
Notifications
You must be signed in to change notification settings - Fork 20
break statement
Cameron Purdy edited this page Apr 9, 2020
·
2 revisions
The break
statement is used to unconditionally transfer control to the end 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 break
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 break
statement cannot identify a target statement.
The break
statement does not complete.
Definite assignment rules:
- The
break
statement contributes the VAS from before thebreak
statement to the end of the target statement. - The target statement will join the contributed VAS with its own ending VAS.
BreakStatement: break Nameopt ;