Logical operators - cradules/cs50 GitHub Wiki

Logical Operators

  • Logical AND (&&) is true only if both operands are true, otherwise false.
    • tue true = true
    • true false = false
    • false true = flase
    • false false = false
  • Logical OR (||) is true if and only if at least one operand is true, otherwise false
    • true true = true
    • true false = true
    • false true = true
    • false false = false
  • logical NOT (!) inverts the value of its operand
    • true = false
    • false = true