2.2 Logical Operators
-
Incorrect
Correct
No Answer was selected
Invalid Answer
Vocabulary
Term | Definition |
---|---|
Boolean | A boolean is a true or false value. |
Variable | A symbol or container that holds a value. |
Logical operator | Used to make logical associations between boolean values |
Or operator | Logical operator that ORs two boolean values. Written as `||`. `a || b` will be true if `a` or `b` is true. |
And operator | Logical operator that ANDs two boolean values. Written as `&&`. `a && b` will be true if both `a` and `b` are true. |
Not operator | Logical operator that negates a single boolean value. Written as `!`. `!a` will be true if `a` is false, and false if `a` is true. |
Negate | To flip a boolean value, or take the opposite of a boolean value. If you negate true, you get false. If you negate false, you get true. |