# ~= operator

Source: https://ref.dm-lang.org/operator/tildeequals
Added in BYOND 512.

### Format
> `A ~= B`

### Returns
> 1 if A and B are equivalent; 0 otherwise

Equivalence is a looser version of equality:

* Two lists are equivalent if their contents are the same. (This is a shallow comparison, so it doesn't check if the Nth items are also equivalent, only equal.)
* Two [/matrix](https://ref.dm-lang.org/matrix/index.md) values are equivalent if their components are the same.
* Datums A and B are equivalent if A [overloads](https://ref.dm-lang.org/operator/overload.md) the \~= operator with a proc that returns true for B. Without an overload, they are only equivalent if they're the same object.

To check if A and B are equal, use the == operator.

> [!note]
> 
> For code compiled in version 516 or later, [associated values](https://ref.dm-lang.org/list/associations.md) in lists are also checked for equality. This was not the case for older versions.

### See also
- [\~! operator](https://ref.dm-lang.org/operator/tildeexclaim.md)
- [== operator](https://ref.dm-lang.org/operator/equalsequals.md)
- [!= operator](https://ref.dm-lang.org/operator/exclaimequals.md)
- [operators](https://ref.dm-lang.org/operator/index.md)
