STATEMENT:  label


label: statements;
 
A label can be used to identify a statement allowing you to refer to it elsewhere in a program. It can be used with the break or continue statements (examples of which can be seen in the relevent pages) to modify the execution of a loop. It can also be used with other statements as in the following example which tests for an even number, and displays it, unless it's a 12:
 
Code:
even_number:
if(i%2==0)
{
   if(i==12)
      break even_number;
   document.write(i);
}


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information