---
name: "selectMax"
type: command
status: ok
groups: ["Arrays"]
arma3_since: "1.66"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/selectMax
revid: 377099
updated: 2026-01-01T09:58:04Z
---

# selectMax

*Command · Arrays · Arma 3 v1.66*

## Description

Returns the array element with [max](../commands/max.md)imum numerical value. Engine solution to [BIS_fnc_greatestNum](../functions/BIS_fnc_greatestNum.md) and [BIS_fnc_findExtreme](../functions/BIS_fnc_findExtreme.md). Therefore it is expected that supplied array consists of [Number](../topics/Number.md)s only. [Boolean](../topics/Boolean.md)s however are also supported and will be evaluated as [Number](../topics/Number.md)s: [true](../commands/true.md) - 1, [false](../commands/false.md) - 0.  [nil](../commands/nil.md) value treated as 0.

> [!WARNING]
> Other non [Number](../topics/Number.md) elements (not recommended) will be evaluated as 0 and **Bad conversion: scalar** message will be logged into .rpt.

## Syntax

```sqf
selectMax array
```

**Parameters:**

- `array`: [Array](../topics/Array.md) of [Number](../topics/Number.md)s

**Returns:** [Number](../topics/Number.md) - element with [max](../commands/max.md)imum numerical value

## Examples

### Example 1

```sqf
_max = selectMax [1,2,3,4,5]; //5
```

### Example 2

```sqf
// Same as, for example: 
_max = _a max _b max _c max _d;
// Only faster:
_max = selectMax [_a,_b,_c,_d];
```

## See also

[selectMin](../commands/selectMin.md) · [min](../commands/min.md) · [max](../commands/max.md) · [selectRandom](../commands/selectRandom.md) · [select](../commands/select.md) · [selectRandomWeighted](../commands/selectRandomWeighted.md)

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