# WolframLang: Equality Test

By Xah Lee. Date: . Last updated: .

Tip on equality test

• Use `SameQ` when the expressions does not contain numbers with decimal point. It always return `True` or `False`.
• Use `Equal` when you have numbers with decimal point.
`SameQ[expr1, expr2]`
(short syntax: `===`)

return `True` if two expressions are symbolically identical, else `False`.

examples:

• `{a,b,c} === {a,b,c}` return `True` because they are the same expression term-by-term.
• `3 === 3.0` return `False` because one is exact number while the other is approx.
• `3 === xyz` return `False` because xyz is a symbol. (unless it has a value of 3)
SameQ
```x = 3;
y = 3.0;
x === y
(* False *)```
`Equal[expr1, expr2]`
(short syntax: `==`)
• return `True` if two expressions are semantically equal. (e.g. `3` vs `3.0`)
• return `False` if two expressions are not semantically equal.
• return whole expression as is, if semantic equality cannot be determined easily or WolframLang quirk.
```3 == 3
(* True *)

3 == 3.0
(* True *)

{3} == {3.0}
(* True *)```

WARNING. `Equal` does not return `True` or `False` even for obvious cases.

```{} == 2
(* return expression as is. Version 13 *)

(* using Reduce makes it true *)
Reduce[ {} == 2 ] === True```
```(* WARNING *)
{{1}} == {2}
(* return expression as is. Version 13 *)

{{1.0}} == {2.0}
(* return expression as is *)```
```x == 3
(* return as is *)

ReplaceAll[ x == 3 , x -> 3 ]
(* True *)```

## Inequality

`UnsameQ`
(short syntax: `=!=`)

Same as `Not[SameQ[x, y]]` .

`Unequal`
(short syntax: `!=`)

Same as `Not[Equal[x, y]]`.