OR (boolean): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "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 ...")
 
No edit summary
Line 12: Line 12:




{{Template:RelationalTable}}
{{RelationalTable}}





Revision as of 12:35, 5 June 2022

The OR conditional operator evaluates an expression to true (-1) if any of the arguments is also true.


Syntax

IF expression1 OR expression2 THEN {code}


Description

  • 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


Examples

Example:

a% = 100
b% = 50

IF (a% > b% AND a% < 100) OR b% = 50 THEN PRINT "True"
True
Explanation: The first evaluation was False, but the OR evaluation made the statement true and the code was executed.


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link