Difference between revisions of "Or"

From MultiCharts
Jump to navigation Jump to search
(Created page with "A logical (Boolean) operator that returns True if one or both of its operands are true. Logical operators are used in logical (Boolean) expressions that operate with true/...")
 
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
A logical (Boolean) operator that returns [[True]] if one or both of its operands are true. Logical operators are used in logical (Boolean) expressions that operate with true/false values.   
 
A logical (Boolean) operator that returns [[True]] if one or both of its operands are true. Logical operators are used in logical (Boolean) expressions that operate with true/false values.   
  
==== Usage ====
+
== Usage ==
 
<syntaxhighlight>E1 Or E2</syntaxhighlight>
 
<syntaxhighlight>E1 Or E2</syntaxhighlight>
  
Where: [[E]] - true/false expressions 
+
Where:  
  
==== Example ====
+
:'''E''' - true/false expressions.
<syntaxhighlight>2=1 Or 2>2</syntaxhighlight>    will return a value of [[False]]
 
 
 
[[True Or False Or False]]  will return a value of [[True]]
 
  
 +
== Notes ==
 +
* If one of the true/false expressions evaluates to [[True]], the whole expression is evaluated as true due to the '''or''' logical operator. For example:
 +
:<syntaxhighlight>(10 > 1) or (10 > 20)</syntaxhighlight>
 +
:Will evaluate to [[True]] since the first expression is true, even though the second expression (10 > 20) is false.
 +
* The whole expression is evaluated as true if '''only one''' of the individual expressions evaluates to true. For example:
 +
:<syntaxhighlight>(10 > 100) or (100 < 2000) or (21 = 1)</syntaxhighlight>
 +
:Will evaluate to [[True]] since the second expression (100 < 2000) is indeed true.
 +
* See [[And]] for logical '''and''' true/false expressions.
  
 +
== Examples ==
 +
<syntaxhighlight>2 = 1 Or 2 > 2</syntaxhighlight>
 +
Will return a value of [[False]].
  
 +
<syntaxhighlight>
 +
True Or False Or False</syntaxhighlight>
 +
Will return a value of True.
  
 
[[Category:Comparisons and Loops]]
 
[[Category:Comparisons and Loops]]

Latest revision as of 10:24, 19 February 2012

A logical (Boolean) operator that returns True if one or both of its operands are true. Logical operators are used in logical (Boolean) expressions that operate with true/false values.

Usage

E1 Or E2

Where:

E - true/false expressions.

Notes

  • If one of the true/false expressions evaluates to True, the whole expression is evaluated as true due to the or logical operator. For example:
(10 > 1) or (10 > 20)
Will evaluate to True since the first expression is true, even though the second expression (10 > 20) is false.
  • The whole expression is evaluated as true if only one of the individual expressions evaluates to true. For example:
(10 > 100) or (100 < 2000) or (21 = 1)
Will evaluate to True since the second expression (100 < 2000) is indeed true.
  • See And for logical and true/false expressions.

Examples

2 = 1 Or 2 > 2

Will return a value of False.

True Or False Or False

Will return a value of True.