RESIZE
Root / Documentation / [.]
Created:
Resize the first dimension of an array.
* Syntax
```sb4
RESIZE array[], dim0%, dim1%, dim2%, dim3%
```
|* Input | Description |
| `array[]` | The array to resize. |
| `dim0%` | The *new* size of the first dimension. |
| `dim1%` |#rs=3 The *current* size of the other dimensions, if they exist. |
| `dim2%` |
| `dim3%` |
`RESIZE` can only change the size of the first dimension of `array[]`. It cannot resize any other dimension, or change the number of dimensions. If `array[]` has more than one dimension, the sizes of all dimensions must be specified, even though they cannot be changed.
* Examples
```sb4
DIM ARRAY1[10]
RESIZE ARRAY1,5
PRINT DIM(ARRAY1,0)
```
```sb4
DIM ARRAY2[10,2]
RESIZE ARRAY2,5,2
PRINT DIM(ARRAY2,0)
```
```sb4
DIM ARRAY3[10,2,3]
RESIZE ARRAY3,5,2,3
PRINT DIM(ARRAY3,0)
```
```sb4
DIM ARRAY4[10,2,3,4]
RESIZE ARRAY4,5,2,3,4
PRINT DIM(ARRAY4,0)
```
```sb4
'Error: wrong number of arguments
DIM ARRAY2[10,2]
RESIZE ARRAY2,5
PRINT DIM(ARRAY2,0)
```
```sb4
'Error: trying to change second dimension
DIM ARRAY2[10,2]
RESIZE ARRAY2,10,5
PRINT DIM(ARRAY2,0)
```
No posts yet (will you be the first?)