Else Command

Conditional execution. If the matching If command and all preceding matching ElseIf commands fail (their expressions evaluate to 0) and if expression is nonzero, subsequent commands until the next matching ElseIf, Else, or EndIf are executed.

Syntax

ElseIf expression [Then]

The Then keyword is optional.

Example

IF PLANE_ALT > 3000 THEN

PRINT "Altitude is greater than 3,000."

ELSEIF PLANE_ALT > 2000 THEN

PRINT "Altitude is greater than 2,000."

ELSEIF PLANE_ALT > 1000

PRINT "Altitude is greater than 1,000."

ELSE

PRINT "Altitude is less than 1,001."

ENDIF