AND (boolean) - mkilgore/QB64pe GitHub Wiki
The AND conditonal operator is used to include another evaluation in an IF...THEN or Boolean statement.
- IF condition AND condition2
- If condition AND condition2 are true then the evaluation returns true (-1).
- condition and condition2 can also contain their own AND evaluations.
- Both the IF evaluation and the AND evaluation must be true for the statement to be true.
- Statements can use parenthesis to clarify an evaluation.
- AND (boolean) and OR (boolean) cannot be used to combine command line operations.
- Not to be confused with the AND and OR numerical operations.
Symbol | Condition | Example Usage |
---|---|---|
< | Less than | IF a < b THEN |
> | Greater than | IF a > b THEN |
= | Equal | IF a = b THEN |
<= | Less than or equal | IF a <= b THEN |
>= | Greater than or equal | IF a >= b THEN |
<> | NOT equal | IF a <> b THEN |
Example: Using AND in an IF statement.
a% = 100 b% = 50 IF...THEN a% > b% AND (boolean) a% < 200 THEN PRINT "True" |
True |
Example: Using a AND a more complex way.
IF...THEN (a% > b% AND (boolean) b% > c%) AND (boolean) (c% < d% AND (boolean) d% < e%) THEN PRINT "True" ELSE PRINT "False" END IF '' '' |
True |
- AND, OR (logical operators)
- OR (boolean), XOR (boolean)
- IF...THEN
Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page