1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 07:41:21 +00:00
qb64/internal/help/OR_(boolean).txt

38 lines
980 B
Plaintext
Raw Normal View History

2019-04-15 01:15:33 +00:00
The '''OR''' conditional operator evaluates an expression to true (-1) if any of the arguments is also true.
2016-03-18 11:36:04 +00:00
{{PageSyntax}}
2019-04-15 01:15:33 +00:00
: [[IF]] {{Parameter|expression1}} '''OR''' {{Parameter|expression2}} THEN {code}
2016-03-18 11:36:04 +00:00
2019-04-15 01:15:33 +00:00
{{PageDescription}}
* OR adds an alternative to another conditional evaluation. If either element in the evaluation is true then the evaluation is true.
2016-03-18 11:36:04 +00:00
* 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}}
2019-04-15 01:15:33 +00:00
{{PageExamples}}
''Example:''
{{CodeStart}}
a% = 100
b% = 50
2019-04-15 01:15:33 +00:00
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.
2019-04-15 01:15:33 +00:00
{{PageSeeAlso}}
2017-10-10 14:55:21 +00:00
* [[AND]], [[OR]] {{text|(logical operators)}}
2016-03-18 11:36:04 +00:00
* [[AND (boolean)]], [[XOR (boolean)]]
* [[IF...THEN]]
2019-04-15 01:15:33 +00:00
{{PageNavigation}}