4D v16.3

APPEND TO ARRAY

Home

 
4D v16.3
APPEND TO ARRAY

APPEND TO ARRAY 


 

APPEND TO ARRAY ( array ; value ) 
Parameter Type   Description
array  Array in Array to which an element will be appended
value  Expression in Value to append

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 IN ARRAY($myarray;Size of array($myarray)+1)
 $myarray{Size of array($myarray)}:=$myvalue

... can be replaced with:

 APPEND TO ARRAY($myarray;$myvalue)



See also 

DELETE FROM ARRAY
INSERT IN ARRAY

 
PROPERTIES 

Product: 4D
Theme: Arrays
Number: 911

This command can be run in preemptive processes

 
HISTORY 

Created: 4D 2004

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)