Monkey Documentation

Keyword Elseif

Where the initial expression in a conditional block proves False, ElseIf allows for the testing of another expression, executing an alternative section of code should that expression prove True.

Syntax

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

Description

Where the initial expression in a conditional block proves False, Elseif (or, optionally, Else If) marks the beginning of an alternative program execution path, whereby the statements following will be executed, but only where the Elseif expression is True.

See also

If | Else | Endif
Language reference

Examples

' Simple If check with alternative program flow dependent on a positive Elseif test:

        If a = 1
                Print "a equals one"
        Elseif a = 0
                Print "a equals zero"
        Endif