---
name: "isEqualTo"
type: command
status: ok
groups: ["Variables"]
arma3_since: "1.16"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/isEqualTo
revid: 336361
updated: 2022-12-29T09:01:58Z
---

# isEqualTo

*Command · Variables · Arma 3 v1.16*

## Description

Performs strict comparison between var1 and var2 and returns [true](../commands/true.md) if equal, otherwise [false](../commands/false.md). Strict means that it would check that both arguments are of the same data type and then compare the values.

Some differences between [isEqualTo](../commands/isEqualTo.md) and ==:
- It performs case sensitive comparison on [String](../topics/String.md)s
- It doesn't throw error when comparing different types, i.e. ("eleven" [isEqualTo](../commands/isEqualTo.md) 11)
- It can compare [Array](../topics/Array.md)s, [Script Handle](../topics/Script_Handle.md)s and [Boolean](../topics/Boolean.md)s ([alive](../commands/alive.md) [player](../commands/player.md) [isEqualTo](../commands/isEqualTo.md) [true](../commands/true.md))
- It can compare non-existent game objects ([grpNull](../commands/grpNull.md) [isEqualTo](../commands/isEqualTo.md) [grpNull](../commands/grpNull.md))
- It is slightly faster than ==, especially when comparing [String](../topics/String.md)s
- Arma 3 v1.48 It can compare [Namespace](../topics/Namespace.md)s

> [!NOTE]
> A compiled code is not equal to the same compiled code made final: 
>
> ```sqf
> _a = compile "123"; _b = compileFinal "123"; _a isEqualTo _b; // false
> ```

> [!WARNING]
> When comparing [Array](../topics/Array.md)s, if an array contains [nil](../commands/nil.md) element, the comparison will return [false](../commands/false.md). For example:
>
> ```sqf
> private _array1 = [1, nil, 2];
> private _array2 = [1, nil, 2];
> _array1 isEqualTo _array2; // false
> ```
>
> UNLESS the compared arrays are the same array:
>
> ```sqf
> private _array1 = [1, nil, 2];
> private _array2 = _array1;
> _array1 isEqualTo _array2; // true
> ```
>
> See: [isEqualRef](../commands/isEqualRef.md) and [BIS_fnc_areEqual](../functions/BIS_fnc_areEqual.md) vs [BIS_fnc_areEqualNotNil](../functions/BIS_fnc_areEqualNotNil.md)

## Syntax

```sqf
val1 isEqualTo val2
```

**Parameters:**

- `val1`: [Anything](../topics/Anything.md)
- `val2`: [Anything](../topics/Anything.md)

**Returns:** [Boolean](../topics/Boolean.md)

## Examples

### Example 1

```sqf
_arr1 = [1, [2, [3]]];
_arr2 = [1, [2, [3]]];
if (_arr1 isEqualTo _arr2) then { hint "Arrays match!" };
```

### Example 2

```sqf
if (a isEqualTo b) then { hint "a is equal to b" };
if !(a isEqualTo b) then { hint "a is not equal to b" };
```

## See also

[isNotEqualTo](../commands/isNotEqualTo.md) · [isEqualRef](../commands/isEqualRef.md) · [isEqualTypeAll](../commands/isEqualTypeAll.md) · [isEqualTypeAny](../commands/isEqualTypeAny.md) · [isEqualType](../commands/isEqualType.md) · [isEqualTypeParams](../commands/isEqualTypeParams.md) · [isEqualTypeArray](../commands/isEqualTypeArray.md) · [a == b](../commands/a_~3D~3D_b.md) · [Operators](../topics/Operators.md)

## Community notes

**Tajin**

Simply put, "isEqualTo" is a binary comparison. Therefor it is very fast but only accepts **100%** identical matches. In some other languages this is known as "===" instead of "==".

---

**Dedmen**

When comparing with nil result is [Nothing](../topics/Nothing.md).

```sqf
nil isEqualTo player;
```

Returns [Nothing](../topics/Nothing.md) instead of expected [false](../commands/false.md)

```sqf
diag_log [nil isEqualTo player];
```

Will print `[bool]`

<sub>Source: [BI Community Wiki — isEqualTo](https://community.bistudio.com/wiki/isEqualTo) (revision 336361).</sub>
