Math Fundamentals18 sections · 814 units
Open in Course

The NOT Operator

Flips the value

The NOT operator flips a boolean value. true becomes false, and false becomes true. Written as ! in most languages, or not in Python. Mathematically: ¬A\neg A.

NOT is a unary operator, meaning it takes one input instead of two. It negates whatever boolean expression follows it.

Example: if (!isBlocked) runs when isBlocked is false. Double negation cancels out: !!true is true again.