Definition: The ! (NOT) operator is a unary operator that negates the value of a boolean expression. It returns true if the expression is false, and false if the expression is true.
Analogy: Think of the ! (NOT) operator as a "flip switch" for boolean values. Just like flipping a light switch changes the state of the light from on to off or vice versa, using the ! (NOT) operator flips the value of a boolean expression.
&& (AND) operator: The && (AND) operator combines two boolean expressions and returns true only if both expressions are true.
|| (OR) operator: The || (OR) operator combines two boolean expressions and returns true if at least one of the expressions is true.
Boolean expression: A boolean expression is an expression that evaluates to either true or false.
© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.