Specifications

x += 5;
if ( x == 50 )
continue;
debug( x );
} while ( x < 100 );
The example outputs 5, 10, 15, ..., 45, 55, 60, 65, ..., 95.
See also continue and break.
else
if ( condition ) {
Statements;
}
else {
ElseStatements;
}
The else keyword is used in conjunction with if. See if for details.
for
for ( i = 0; i < limit; i++ ) {
Statements;
}
This keyword is used to create a loop that executes a fixed number of times.
The for statement is broken into parts as follows: the keyword for, an opening parentheses, zero
or more statements (the first part), a semi-colon, a conditional expression (the second part), a
semi-colon, zero or more statements (the third part), a closing parentheses and finally a statement
or block that is governed by the for loop.
The first part of the for statement is typically used to initialize (and possibly declare) the variable
used in the conditional in the second part of the for loop statement. This part is executed once
before the loop begins. This part may be empty.
The second part contains a conditional expression. The expression is evaluated before each
iteration of the loop (including before the first iteration). If this expression evaluates to false,
the statement or block governed by the for loop is not executed and control passes to the
statement that follows. If the condition is never true, the statement or block governed by the
for loop will never be executed. If the condition expression is true, the statement or block
governed by the for loop is executed and then the third part of the for statement is executed,
before control is passed back to the conditional expression with the whole process being repeated.
This part should not be empty.
The third part contains statements which must be executed at the end of every iteration of the
loop. This part is typically used to increment a variable that was initialized in the first part and
whose value is tested in the second part. This part may be empty.
Example:
var a = [ "a", "b", "c", "d", "e" ];
for( var i = 0; i < a.length; i++ ) {
debug( a[ i ] );
}
See also continue and break.
403
Enfocus Switch 10