If…[Then] Command

Conditionally executes the subsequent commands. If expression is nonzero, the If…[Then] command executes the subsequent commands until the next matching ElseIf, Else, or EndIf, are executed.

Syntax

If expression [ Then ]

The Then keyword is optional.

Example

'These two are functionally equivalent.

IF PLANE_ALT = 6000 THEN

PRINT "Aircraft altitude equals 6,000."

ENDIF

IF PLANE_ALT = 6000

PRINT "Aircraft altitude equals 6,000."

ENDIF