---
name: "resize"
type: command
status: ok
groups: ["Arrays"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/resize
revid: 364809
updated: 2024-06-15T13:16:01Z
---

# resize

*Command · Arrays · Arma 3 v0.50 · introduced in Operation Flashpoint v1.75*

## Description

Changes the size of the given array. The command does not return new array, it resizes the source array to the desired number of elements.
If the new size is bigger than the current size, the new places are filled with [nil](../commands/nil.md). The [alternative syntax](../commands/resize.md#syntax-2) allows to fill resized positions with a given value. [Array](../topics/Array.md) and [HashMap](../topics/HashMap.md) values are copied.

## Syntax

### Syntax 1

```sqf
array resize count
```

**Parameters:**

- `array`: [Array](../topics/Array.md) of [Anything](../topics/Anything.md)
- `count`: [Number](../topics/Number.md) - the new array size

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

### Syntax 2

*since arma3 2.10*

```sqf
array resize [count, fill]
```

**Parameters:**

- `array`: [Array](../topics/Array.md) of [Anything](../topics/Anything.md)
- `count`: [Number](../topics/Number.md) - the new array size
- `fill`: [Anything](../topics/Anything.md) - value to fill added positions

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

## Examples

### Example 1

```sqf
_arrayNum = [0,1,2,3,4];
_arrayNum resize 2; // _arrayNum is now [0, 1]
_arrayNum resize 5; // _arrayNum is now [0, 1, nil, nil, nil]
```

### Example 2

```sqf
private _array = [0, 1, 2];
_array resize [5, -1]; // _array is now [0, 1, 2, -1, -1]

private _array = [0, 1, 2];
_array resize [1, -1]; // _array is now [0]

private _array = [0, 1, 2];
_array resize [4, "something"]; // _array is now [0, 1, 2, "something"]
```

## See also

[set](../commands/set.md) · [reverse](../commands/reverse.md) · [deleteAt](../commands/deleteAt.md) · [deleteRange](../commands/deleteRange.md)

## Community notes

**DreadedEntity** — 2014-11-13

Use this number to resize the array to the number of elements desired, not the desired index of the final element.

[resize](../commands/resize.md) cannot be used to create a new array.

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