Specifications

Catch blocks come in two varieties, unqualified and qualified. An unqualified catch block has
the form:
catch ( e ) { /* statements */ }
and a qualified catch block has the form:
catch ( e if e instanceOf RangeError ) { /* statements */ }
See catch for details of the qualifiers.
try...finally
If an exception occurs within a try...finally block, control is passed to the finally block. This is
useful if you want to ensure that something happens at the end of the block, no matter what.
Examples:
try {
file = new File;
file.open( filename );
process( file );
}
finally {
file.close();
}
In this example, the file is always closed, even if an exception occurred.
try {
var a = monthToName( 11 );
var b = monthToName( 2 );
}
catch ( e ) {
if ( e == "month number out of range" ) {
debug( "Code error: " + e );
}
else {
throw e;
}
}
In this example, the monthToName() function is called to set two variables. If the function fails,
it throws an exception rather than returns an error value, so no explicit check for an error value
is necessary. If one of the function calls failed debug() is called; otherwise the exception is
re-thrown so that it can be handled at a higher level. (See throw for the definition of
monthToName().)
while
while ( condition ) {
Statements;
}
This keyword is used to repeat a block of code zero or more times. When the while statement is
encountered the condition is evaluated. If the condition is true, the Statements in the while
block are executed; otherwise control passes to the statement following the while block. If the
condition is true, after the Statements have been executed, the condition is again evaluated
and the whole process repeats.
407
Enfocus Switch 10