Or: Difference between revisions
From MultiCharts
m
→Notes
m (→Notes) |
|||
(3 intermediate revisions by 3 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 == | |||
<syntaxhighlight>E1 Or E2</syntaxhighlight> | <syntaxhighlight>E1 Or E2</syntaxhighlight> | ||
Where: | 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: | |||
:<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]] |