APPEND TO 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

version 2004


APPEND TO ARRAY (array; value)

ParameterTypeDescription
arrayArrayArray to which an element will be appended
valueExpressionValue to append

Description

The APPEND TO ARRAY command adds a new element at the end of array and assigns value to the element. In interpreted mode, if array does not exist, the command creates it with regard to the type of value.

This command works with all kind of arrays: string, number, Boolean, date, pointer and picture.

The type of value must match the array type, otherwise the syntax error 54 "Argument types are incompatible" is generated. The following values will, however, be accepted:

a string array (Text or String) accepts any value of the Text or String type.

a number array (Integer, Longint or Real) accepts any value of the Integer, Longint, Real or Time type.

Example

The following code:

   INSERT ELEMENT($myarray;Size of array($myarray)+1)
   $myarray{Size of array($myarray)}:=$myvalue

... can be replaced with:

   APPEND TO ARRAY($myarray;$myvalue)

See Also

DELETE ELEMENT, 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