Skip to content

INSERT ARRAY

Insert Array Entries

This directive inserts elements of an array.

INSERT ARRAY array-name [(pos1,count1) [ , (pos2,count2)
[ , (pos3,count3)]]]
array-name
is the name of an array followed by the left square bracket or, optionally, the left parenthesis in case of a numeric array.
pos1,2,3
is the starting position where inserting begins.
count1,2,3
is the amount of elements that are inserted.

This directive is generally available starting with release level 8.2.

Inserting indices in a multi-dimensional array changes the dimensions of the array. For example, in a 4x4x4 array, doing an INSERT ARRAY A[(0,2)] does not add two elements, it changes the array to a 6x4x4 array, essentially adding 2x4x4=32 elements.

If there is not enough memory to expand the array during INSERT ARRAY, an ERR=33 results.

If any of the positions or counts are not integers, an ERR=41 results.

If the array does not exist, an ERR=42 results.

On an INSERT ARRAY, if the array has more than 65,000 elements, an ERR=42 results.

If an attempt is made to INSERT elements before the starting position of the dimension, an ERR=42 results.

If an attempt is made to INSERT elements after the last element in the dimension +1, an ERR=42 results.

00100 DIM A[3,3,3]
00020 INSERT ARRAY A[(0,2)]

creates a 4x4x4 numeric array, then inserts 2 elements into the first part of the array, creating a 6x4x4 array.

DELETE ARRAY directive

From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF