Difference between revisions of "Boolean Operators"
From SmartWiki
(3 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
* The '''AND''' operator takes two [[operand]]s and evaluates to ''true'' if '''both''' of its operands are true. | * The '''AND''' operator takes two [[operand]]s and evaluates to ''true'' if '''both''' of its operands are true. | ||
− | * Also written as "&&". | + | * Also written as "&&", between the two operands. |
Example: [True Statement] AND [False Statement] ...evaluates to... '''FALSE''' | Example: [True Statement] AND [False Statement] ...evaluates to... '''FALSE''' | ||
Example: [True Statement] AND [True Statement] ...evaluates to... '''TRUE''' | Example: [True Statement] AND [True Statement] ...evaluates to... '''TRUE''' | ||
Line 8: | Line 8: | ||
==OR== | ==OR== | ||
− | * The ''OR'' operator takes two [[operand]]s and evaluates to ''true'' if '''either''' of the operands are true. | + | * The '''OR''' operator takes two [[operand]]s and evaluates to ''true'' if '''either''' of the operands are true. |
− | * Also written as "||". | + | * Also written as "||", between the two operands. |
Example: [True Statement] OR [True Statement] ...evaluates to... '''TRUE''' | Example: [True Statement] OR [True Statement] ...evaluates to... '''TRUE''' | ||
Example: [True Statement] OR [False Statement] ...evaluates to... '''TRUE''' | Example: [True Statement] OR [False Statement] ...evaluates to... '''TRUE''' | ||
Line 25: | Line 25: | ||
* [[Advanced Search]] | * [[Advanced Search]] | ||
− | [[Category: | + | [[Category:Variables]] |
Latest revision as of 12:36, 20 October 2017
Contents
AND
- The AND operator takes two operands and evaluates to true if both of its operands are true.
- Also written as "&&", between the two operands.
Example: [True Statement] AND [False Statement] ...evaluates to... FALSE Example: [True Statement] AND [True Statement] ...evaluates to... TRUE
OR
- The OR operator takes two operands and evaluates to true if either of the operands are true.
- Also written as "||", between the two operands.
Example: [True Statement] OR [True Statement] ...evaluates to... TRUE Example: [True Statement] OR [False Statement] ...evaluates to... TRUE Example: [False Statement] OR [False Statement] ...evaluates to... FALSE
NOT
- Reverses the "truthiness" of its operand.
- Also written as "!", preceding its operand.
Example: NOT [True Statement] ...evaluates to... FALSE Example: NOT [False Statement] ...evaluates to... TRUE