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