GLBasic User Manual

Main sections

ELSEIF

IF a#$ = < <= > >= <> b#$
...
| ELSEIF ...
| ...
| ELSE
| ...
ENDIF



or:

IF a#$ = < <= > >= <> b#$ THEN ...



An ELSEIF statement indicates a new condition to be evaluated in the instance that the initial condition evaluates to a false state. It also marks the beginning of a code block to be executed in the event that this new condition evaluates to a true state.

IF a>5
PRINT "a>5", 0,0
ELSEIF b>5
PRINT "a<=5, but b>5", 0,0
ELSE
PRINT "Neither a nor b > 5", 0,0
ENDIF


You can use the command THEN if you only want one command to be executed if the comparison is TRUE.

Sample:
 
a=5; b=3

IF a < b
PRINT "a < b", 100, 100
ELSE
PRINT "a < b is FALSE", 100, 100
ENDIF

IF a<>b THEN PRINT "a is not b", 100, 150

SHOWSCREEN
MOUSEWAIT


Output:
a < b is FALSE
a is not b

See also...