Or: Difference between revisions

From MultiCharts
m (Reverted edits by 176.8.90.7 (talk) to last revision by 194.84.116.138)
No edit summary
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  will return a value of False
 
True Or False Or False  will return a value of True </syntaxhighlight>


== 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 '''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]]

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 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.