---
name: "in"
type: command
status: ok
groups: ["Strings", "Arrays", "Locations", "HashMap", "Unit Control"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/in
revid: 377765
updated: 2026-01-03T01:00:35Z
---

# in

*Command · Strings, Arrays, Locations, HashMap, Unit Control · Arma 3 v0.50 · introduced in Operation Flashpoint v1.00*

## Description

Checks whether value is in array, unit is in vehicle, position is inside location or ANSI string is part of other ANSI string. If Unicode support is desired, see [forceUnicode](../commands/forceUnicode.md).

> [!NOTE]
> [String](../topics/String.md) comparison is case-sensitive (see Examples **2** and **6**).

## Syntax

### Syntax 1

```sqf
value in array
```

**Parameters:**

- `value`: [Anything](../topics/Anything.md) - any value (cannot  match [Array](../topics/Array.md) before Arma 3)
- `array`: [Array](../topics/Array.md) - array of values

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

### Syntax 2

```sqf
unit in vehicle
```

**Parameters:**

- `unit`: [Object](../topics/Object.md) - [alive](../commands/alive.md) unit
- `vehicle`: [Object](../topics/Object.md) - entity vehicle

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

### Syntax 3

*since arma3 0.50*

```sqf
position in location
```

**Parameters:**

- `position`: [Position2D](../topics/Position.md#introduction) or [Position3D](../topics/Position.md#introduction)
- `location`: [Location](../topics/Location.md)

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

### Syntax 4

*since arma3 1.96*

```sqf
needle in haystack
```

**Parameters:**

- `needle`: [String](../topics/String.md) - string to search **for**
- `haystack`: [String](../topics/String.md) - string to search **in**

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

### Syntax 5

*since arma3 2.02*

```sqf
key in hashMap
```

**Parameters:**

- `key`: [HashMapKey](../topics/HashMapKey.md)
- `hashMap` : [HashMap](../topics/HashMap.md)

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

## Examples

### Example 1

```sqf
1 in [0, 1, 2]; // true
```

### Example 2

```sqf
private _myArray = ["Aaa", "AAa", "AAA"];

"aaa" in _myArray; // false
"AAa" in _myArray; // true

// Case-insensitive alternatives:
_myArray findIf { _x == "aaa"; } != -1; // true

({
    if (_x == "aaa") exitWith { _forEachIndex };
    -1
} forEach _myArray) != -1; // true, less performant but valid before the introduction of the findIf command

{ if (_x == "aaa") exitWith { 1 } } count _myArray > 0; // true

{ _x == "aaa"; } count _myArray > 0; // true, worst performance, only option available in OFP
```

### Example 3

```sqf
[1,2,3] in [[1,2,3], [4,5,6]]; // true - Arma 3 only
```

### Example 4

```sqf
private _isInCar = player in Car;
```

### Example 5

```sqf
private _isInside = [1000,2000,0] in MyLocation;
```

### Example 6

```sqf
private _isInString = "foo" in "foobar"; // true
_isInString = "Foo" in "foobar"; // false
```

### Example 7

```sqf
private _onFoot = _unit in _unit;
```

Other options:

```sqf
private _onFoot = vehicle _unit == _unit;
```

```sqf
private _onFoot = isNull objectParent _unit;
```

## See also

[inPolygon](../commands/inPolygon.md) · [inArea](../commands/inArea.md) · [find](../commands/find.md) · [findIf](../commands/findIf.md) · [toArray](../commands/toArray.md) · [forceUnicode](../commands/forceUnicode.md)

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