mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 03:15:07 +00:00
37 lines
980 B
Text
37 lines
980 B
Text
The '''OR''' conditional operator evaluates an expression to true (-1) if any of the arguments is also true.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: [[IF]] {{Parameter|expression1}} '''OR''' {{Parameter|expression2}} THEN {code}
|
|
|
|
|
|
{{PageDescription}}
|
|
* OR adds an alternative to another conditional evaluation. If either element in the evaluation is true then the evaluation is true.
|
|
* Parenthesis may be used to clarify the order of comparisons in an evaluation.
|
|
* Not to be confused with the [[AND]] and [[OR]] numerical operations.
|
|
|
|
|
|
{{Template:RelationalTable}}
|
|
|
|
|
|
{{PageExamples}}
|
|
''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.
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[AND]], [[OR]] {{text|(logical operators)}}
|
|
* [[AND (boolean)]], [[XOR (boolean)]]
|
|
* [[IF...THEN]]
|
|
|
|
|
|
{{PageNavigation}}
|