C.3. Statements

StatementDescription
break [label]Breaks out of the current loop, or the loop designated by the optional label. Program execution continues on the first line outside the corresponding loop.
comment (// and /* */)Use either construct (double-slash or slash-asterisk) to create a comment in the code. The double-slash method can be used for a one-line or end-of-line comment:
// this is a comment
i++;  // increment I
The slash-asterisk method can be used for multiline comments:
/* function circle_area
   arguments: radius
   returns: area of circle */
continue [label]Causes the current loop, or the loop designated by the optional label,to end the current iteration and begin the next. Program execution resumes at the beginning of the appropriate loop, performing any increment or other action as appropriate at the start of another iteration.
do {
 // loop code
} while (expr);
Perform the loop code while expr evaluates to true. Note that since the conditional statement is at the end of the loop, the loop code will execute at least once.
export mxed1 [,mixed2..., mixedN]Exports the functions, objects, properties, or methods specified (mixed), making them available for other scripts to import.
for (init_expr;
cond_expr; loop_expr){
 // loop code
}
The for loop is a complex loop structure typically used to iterate over a sequence of numbers (for example, 1-10). At the start of the loop the init_expr is evaluated and the cond_expr is also evaluated. The loop executes as long as cond_expr ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.