<div class="meta" robots="noindex">

</div>

Method

# Insert

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Arrays.AddAt<arrays.addat>` as a replacement.

</div>

## Description

Inserts a new element into an array. Arrays are zero-based.

## Usage

*array*.**Insert** *index*, *value*

| Part  | Type                               | Description                                                                            |
|-------|------------------------------------|----------------------------------------------------------------------------------------|
| array | array of any valid data type       | The array in which to insert the new element.                                          |
| index | `Integer</api/data_types/integer>` | The position in *array* to insert the new element, i.e., the index of the new element. |
| value | Datatype of *array*                | The value to be assigned to the new array element.                                     |

## Notes

The <span class="title-ref">Insert</span> method works with one-dimensional arrays only.

All arrays are indexed starting at position 0. Arrays can have a maximum index value of 2,147,483,646.

## Sample code

Suppose array "a" is defined as:

``` xojo
a = Array("Leonard", "Adolph", "Herbert")
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The statement:

``` xojo
a.Insert(2, "Bill")
```

## Compatibility

All project types on all supported operating systems.

## See also

`Arrays<arrays.add>`, `Array</api/language/array>`, `Arrays.IndexOf<arrays.indexof>`, `Redim</api/language/redim>`, `Arrays<arrays.removeat>`, `Shuffle</api/language/shuffle>`, `Sort<arrays.sort>` methods; `Dim</api/language/dim>`, `Redim</api/language/redim>` statements; `Arrays.LastIndex<arrays.lastindex>` function; `Arrays</api/language/arrays>` concept
