Keyword Else

Marks the start of alternative program flow should a conditional expression prove False.

Syntax

If expression [Then]
Statements...
Else
Statements...
Endif

Description

Else marks the beginning of an alternative program execution path, where the statements following will be executed if expression is False.

Else can also be used in the single-line variant of If; the expression to be tested is followed by a statement to be executed in the True case, followed by the Else keyword, followed by the statement(s) to be executed in the False case. See If for more information on the single-line If variant.

See also

If | Elseif | Endif
Language reference

Examples

' Simple If check with alternative program flow following Else:
 
        If a = 1 
                Print "a equals one" 
        Else 
                Print "a equals zero" 
        Endif 
 
' Single-line variant:
 
        If a = 1 Then Print "a equals one" Else Print "a equals zero"