Visit Mozilla.org

Core JavaScript 1.5 Reference:Statements:label

From MDC


Contents

[edit] Summary

Provides a statement with an identifier that you can refer to using a break or continue statement.

For example, you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop or continue its execution.

Statement
Implemented in: JavaScript 1.2, NES 3.0
ECMA Version: ECMA-262, Edition 3

[edit] Syntax

label :
   statement

[edit] Parameters

label 
Any JavaScript identifier that is not a reserved word.
statement 
Statements. break can be used with any labeled statement, and continue can be used with looping labeled statements.

[edit] Examples

For an example of a label statement using break, see break. For an example of a label statement using continue, see continue.

[edit] See also

break, continue