2015-08-02 12:12:44 +00:00
|
|
|
The '''OR''' coditional operator adds an alternative in a [[IF...THEN]] or [[Boolean]] statement.
|
|
|
|
|
|
|
|
|
2016-03-18 11:36:04 +00:00
|
|
|
{{PageSyntax}}
|
|
|
|
:: IF a = 1 '''OR''' a = 2 THEN a = 0
|
|
|
|
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
* OR adds an alternative to another conditional evaluation. IF True then the statement evaluation is True.
|
2016-03-18 11:36:04 +00:00
|
|
|
* 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 double OR syntax error may be ignored and create a QB64 compiler error!'''
|
|
|
|
* Not to be confused with the [[AND]] and [[OR]] numerical operations.
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{Template:RelationalTable}}
|
|
|
|
|
|
|
|
|
|
|
|
''Example:''
|
|
|
|
{{CodeStart}}
|
|
|
|
a% = 100
|
|
|
|
b% = 50
|
|
|
|
|
|
|
|
IF (a% > b% AND a% < 100) OR b% = 50 THEN PRINT "True"
|
|
|
|
{{CodeEnd}}
|
|
|
|
{{OutputStart}}
|
|
|
|
True
|
|
|
|
{{OutputEnd}}
|
|
|
|
: ''Explanation:'' The first evaluation was False, but the OR evaluation made the statement true and the code was executed.
|
|
|
|
|
|
|
|
|
|
|
|
''See also:''
|
2016-03-18 11:36:04 +00:00
|
|
|
* [[AND (boolean)]], [[XOR (boolean)]]
|
|
|
|
* [[IF...THEN]]
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{PageNavigation}}
|