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

The AND (boolean) conditonal operator is used to include another evaluation in an IF…THEN or Boolean statement.


IF condition AND (boolean) condition2


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


Using AND in an IF statement.

a% = 100
b% = 50

IF a% > b% AND a% < 200 THEN PRINT "True"


Explanation: Both condition evaluations must be true for the code to be executed.

Using a AND a more complex way.

a% = 100
b% = 50
c% = 25
d% = 50
e% = 100

IF (a% > b% AND b% > c%) AND (c% < d% AND d% < e%) THEN
PRINT "True"
PRINT "False"


Explanation: The evaluations in the paranteses are evaluated first then the evaluation of the paranteses takes place, since all evaluations return True the IF…THEN evaluation returns True. If any of the evaluations returned False then the IF…THEN evaluation would also return False.

See Also