QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

ELSEIF is used in an IF…THEN block statement to offer an alternative condition.

Syntax

IF condition THEN

{code}

ELSEIF condition2 THEN~

{code}

ELSE

{alternative-code}

END IF

Description

Relational Operators:

Symbol Condition Example Usage
= Equal IF a = b THEN
<> NOT equal IF a <> b THEN
< Less than IF a < b THEN
> Greater than IF a > b THEN
<= Less than or equal IF a <= b THEN
>= Greater than or equal IF a >= b THEN

Example(s)

IF statement using ELSE IF in one statement line.


IF x = 100 THEN COLOR 10: PRINT x ELSE IF x > 100 THEN COLOR 12: PRINT x ELSE PRINT "< 100"


IF statement block


IF x = 100 THEN ' must place ANY code on next line!
  COLOR 10: PRINT x
ELSEIF x > 100 THEN COLOR 12: PRINT x
ELSE : PRINT "< 100"
END IF


See Also

*ELSE, END IF *IF…THEN