OR (boolean)

From QB64 Wiki
Revision as of 00:31, 7 August 2013 by imported>Clippy
Jump to navigation Jump to search

The OR coditional operator adds an alternative in a IF...THEN or Boolean statement.


IF a = 1 OR a = 2 THEN a = 0

  • OR adds an alternative to another conditional evaluation. IF True then the statement evaluation is True.
  • Parenthesis may be used to clarify the order of comparisons in an evaluation.
  • AND and OR cannot be used to combine command line operations.
  • A duplicate OR OR statement will create a QB64 compiler error!
  • Not to be confused with the AND and OR numerical operations.

Relational Operators:
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


a% = 100 b% = 50 IF (a% > b% AND a% < 100) OR b% = 50 THEN PRINT "True"


Explanation: The first evaluation was False, but the OR evaluation made the statement true and the code was executed.

See also:

Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page