Difference between revisions of "OR (boolean)"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
imported>Clippy
m
Line 9: Line 9:
  
 
''Example:''  
 
''Example:''  
 +
{{CodeStart}}
 +
a% = 100
 +
b% = 50
  
:a% = 100
+
IF (a% > b% AND a% < 100) OR b% = 50 THEN PRINT "True"
:b% = 50
+
{{CodeEnd}}
 +
{{OutputStart}}
 +
True
 +
{{OutputEnd}}
 +
: ''Explanation:'' The first evaluation was False, but the OR evaluation made the statement true and the code was executed.
  
: IF (a% > b% AND a% < 100) OR b% = 50 THEN PRINT "True"
 
  
  
''Screen results:'' True
+
''See also:''  
 +
* [[AND (boolean)]]
  
  
''Explanation:'' The first evaluation was False, but the OR evaluation made the statement true and the code was executed.
+
{{PageNavigation}}
 
 
 
 
 
 
''See also:'' [[AND (boolean)]]
 
 
 
 
 
 
 
==Navigation:==
 
 
 
[[Keyword_Reference_-_Alphabetical|Go to Keyword Reference - Alphabetical]]
 
 
 
[[Keyword Reference - By usage|Go to Keyword Reference - By usage]]
 

Revision as of 23:58, 9 May 2011

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


  • OR adds an alternative to another conditional evaluation. IF True then the statement evaluation is True.
  • Parenthesis may be used to clarify an evaluation.
  • Can be confused with the OR numerical operator.


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:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page