INSERT ELEMENT

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


INSERT ELEMENT (array; where{; howMany})

ParameterTypeDescription
arrayArrayName of the array
whereNumberWhere to insert the elements
howManyNumberNumber of elements to be inserted, or
1 element if omitted

Description

The INSERT ELEMENT command inserts one or more elements into the array array. The new elements are inserted before the element specified by where, and are initialized to the empty value for the array type. All elements beyond where are consequently moved within the array by an offset of one or the value you pass in howMany.

If where is greater than the size of the array, the elements are added to the end of the array.

The howMany parameter is the number of elements to insert. If howMany is not specified, then one element is inserted. The size of the array grows by howMany.

Examples

1. The following example inserts five new elements, starting at element 10:

   INSERT ELEMENT (anArray;10;5)

2. The following example appends an element to an array:

   $vlElem:=Size of array(anArray)+1
   INSERT ELEMENT (anArray;$vlElem)
   anArray{$vlElem}:=...

See Also

DELETE ELEMENT, Size of array.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next