---
name: "param"
type: command
status: ok
groups: ["Variables", "Arrays"]
arma3_since: "1.48"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/param
revid: 369264
updated: 2024-09-03T18:42:42Z
---

# param

*Command · Variables, Arrays · Arma 3 v1.48*

## Description

Extracts a single value with given index from input argument, similar to [BIS_fnc_param](../functions/BIS_fnc_param.md).  When used without argument, as shown in main syntax, internal variable [_this](../topics/Magic_Variables.md#this), which is usually available inside functions and event handlers, is used as argument. If input argument is not an array, it will be converted to 1 element array.

If extracted item of input with given index is undefined, of the wrong type or of the wrong length (if the item is an array), default value is used instead. Since Arma 3 v1.54, onscreen errors are displayed for when the input is of the wrong type or size.

## Syntax

### Syntax 1

```sqf
param [index, defaultValue, expectedDataTypes, expectedArrayCount]
```

**Parameters:**

- `index`: [Number](../topics/Number.md) - index of required item in the input array.
- `defaultValue`: [Anything](../topics/Anything.md) - (Optional) a default value to return if input is undefined, of the wrong type or of the wrong length (if the item is an array).
- `expectedDataTypes`: [Array](../topics/Array.md) of direct Data Types - (Optional) checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.
- `expectedArrayCount`: [Number](../topics/Number.md) or [Array](../topics/Array.md) - (Optional) a single size or array of sizes. If passed input value is an array, checks that it has a certain number of elements. If not, default value is used instead. Empty array [] means any size is accepted.

**Returns:** [Anything](../topics/Anything.md) - extracted value on success or default value otherwise. [Nothing](../topics/Nothing.md) if syntax error occurred.

### Syntax 2

```sqf
argument param [index, defaultValue, expectedDataTypes, expectedArrayCount]
```

**Parameters:**

- `argument`: [Anything](../topics/Anything.md) - a usual array of params is expected. If a non-array value is passed, it will be converted to 1 element array
- `index`: [Number](../topics/Number.md) - index of required item in the input array.
- `defaultValue`: [Anything](../topics/Anything.md) - (Optional) a default value to return if input is undefined, of the wrong type or of the wrong length (if the item is an array).
- `expectedDataTypes`: [Array](../topics/Array.md) of direct Data Types - (Optional) checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.
- `expectedArrayCount`: [Number](../topics/Number.md) or [Array](../topics/Array.md) - (Optional) a single size or array of sizes. If passed input value is an array, checks that it has a certain number of elements. If not, default value is used instead. Empty array [] means any size is accepted.

**Returns:** [Anything](../topics/Anything.md) - extracted value on success or default value otherwise. [Nothing](../topics/Nothing.md) if syntax error occurred.

## Examples

### Example 1

```sqf
[1, 2, 3] call 
{
    private _one = param [0, 1];
    private _two = param [1, 2];
    private _three = param [2, 3];
    // ...
};
```

### Example 2

```sqf
[123] call 
{
    private _val = param [0];
};

// Below would produce the same result as above
123 call 
{
    private _val = param [0];
};
```

### Example 3

```sqf
_z = position player param [2, 0];
if (_z > 10) then 
{
    hint "YOU ARE FLYING!";
};
```

### Example 4

```sqf
fnc = 
{
    private _pos = param [0, [0,0,0], [objNull, []], [2,3]];
    private _rad = param [1, 0, [0]];
    _pos nearObjects _rad;
};

[position player, 25] call fnc; // ok
[player, 25] call fnc; // ok
[25, player] call fnc; // default values are used
```

## See also

[params](../commands/params.md) · [select](../commands/select.md) · [set](../commands/set.md) · [resize](../commands/resize.md) · [reverse](../commands/reverse.md) · [in](../commands/in.md) · [find](../commands/find.md) · [findIf](../commands/findIf.md) · [toArray](../commands/toArray.md) · [toString](../commands/toString.md) · [forEach](../commands/forEach.md) · [count](../commands/count.md) · [deleteAt](../commands/deleteAt.md) · [deleteRange](../commands/deleteRange.md) · [append](../commands/append.md) · [sort](../commands/sort.md) · [arrayIntersect](../commands/arrayIntersect.md) · [splitString](../commands/splitString.md) · [joinString](../commands/joinString.md) · [isEqualTypeAll](../commands/isEqualTypeAll.md) · [isEqualType](../commands/isEqualType.md) · [isEqualTypeParams](../commands/isEqualTypeParams.md) · [isEqualTypeArray](../commands/isEqualTypeArray.md) · [isEqualTypeAny](../commands/isEqualTypeAny.md) · [typeName](../commands/typeName.md) · [BIS_fnc_param](../functions/BIS_fnc_param.md)

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