else ... (Keyword)

Part of the if ... else conditional code execution mechanism.

Availability:

ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise Server - 2.0
JavaScript syntax:-if(aCondition){someCode1} else{someCode2}
Argument list:aConditionA condition that tests true or false
someCode1Code to be executed if the condition tests true
someCode2Code to be executed if the condition tests false

This is an optional additional statement that can be added to an if() condition test to allow for some alternative code to be executed when the condition tests false. The true case will cause the first block of code to be executed, the false case will execute the second (that which follows the else keyword).

See also:else if( ... ) ..., Flow control, if( ... ) ..., if( ... ) ... else ..., Selection statement, switch( ... ) ... case: ... default: ...

Cross-references:

ECMA 262 edition 2 - section - 12.5

ECMA 262 edition 3 - section - 12.5

Wrox Instant JavaScript - page - 23