# Equality

Equality determines whether two expressions have equivalent values.

Related concepts: OperatorValue

*Closest Wikipedia entry:* Equality (mathematics) — In mathematics, equality is a relationship between two quantities or, more generally, two mathematical expressions, asserting that the quantities have the same value, or that the expressions represent the same mathematical object. Equality between A and B is written A = B, and pronounced "A equals B". The symbol "=" is called an "equals sign".

## Misconceptions about Equality12 documented Misconceptions

Check YourselfAssignCompares — Java

= compares two valuesAssignCompares — Python

= compares two valuesCompareBooleanToConstant — Scratch

To test whether an expression evaluates to true or false, one must compare it to a constantComparisonWithBoolLiteral — Python

To test whether an expression is True or False, one must compare it to True or to FalseComparisonWithBooleanLiteral — Java

To test whether an expression is true or false, one must compare it to true or to falseEqualityOperatorComparesListIdentities — Scratch

(list a) = (list b) compares the identities of list a and list bEqualityOperatorComparesObjectsValues — Java

o==p compares the objects referred to by variables o and pEqualityOperatorComparesObjectsValues — JavaScript

The equality operator compares two objects' valuesEqualityOperatorComparesOnlyTypes — JavaScript

The equality operator '==' compares only the types of the operandsEqualityOperatorComparesOnlyTypes — Scratch

() = () compares only the types of its operandsEqualsComparesReferences — Java

o.equals(p) compares the references stored in the variables o and pNullAndUndefinedAreTheSame — JavaScript

The values null and undefined are the same