Codecademy Logo

Learn How to Code with Blockly: If Statements

AND Operator

In programming, the logical AND operator (&&) compares two values. It returns true when both values evaluate to true and false otherwise.

The following evaluates to true: grass is green AND fire is red 2 > 1 AND 6 > 5 3 == 3 AND 8 == 8

While this evaluates to false: trees are large AND ant are massive 5 < 4 AND 6 > 3 7 == 7 AND 0 == 9

Learn more on Codecademy