---
name: "BIS_fnc_conditionalSelect"
type: function
status: ok
groups: ["Arrays"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_conditionalSelect
revid: 327949
updated: 2022-07-13T12:57:27Z
---

# BIS_fnc_conditionalSelect

*Function · Arrays · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

This returns a sub-array of elements that satisfy a specific condition **in the order they have been passed**.

> [!NOTE]
> **Arma 3:** Since Arma 3 v1.55, use `array select condition` instead.

In the condition, the currently tested element is assigned to the variable "[_x](../topics/Magic_Variables.md#x)".
The original array is **not** modified.

## Syntax

```sqf
[items, condition] call BIS_fnc_conditionalSelect
```

**Parameters:**

- `items`: [Array](../topics/Array.md) - array to check
- `condition`: [Code](../topics/Code.md) - selection code

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

## Examples

### Example 1

```sqf
[[10, 0, 8, 2, 6, 4], { _x > 5 }] call BIS_fnc_conditionalSelect; // will return [10,8,6]
```

### Example 2

```sqf
[[10, true, 8, player], { typeName _x == "STRING" }] call BIS_fnc_conditionalSelect; // will return []
```

## See also

[select](../commands/select.md) · [count](../commands/count.md)

<sub>Source: [BI Community Wiki — BIS fnc conditionalSelect](https://community.bistudio.com/wiki/BIS_fnc_conditionalSelect) (revision 327949).</sub>
