AAdd()
Add a new element to the end of an array.
Syntax
AAdd(<aTarget>, <expValue>) --> Value
Arguments
<aTarget> --> is the array to add a new element to.
<expValue> --> is the value assigned to the new element.
Returns
AAdd() evaluates <expValue> and returns its value. If <expValue> is not specified, AAdd() returns Nil. (No value.)
Description
Once an array has been created, elements can be added using the AAdd() function. AAdd() increases the actual length of the target array by one. The newly created array element is assigned the value specified by <expValue>. AAdd() is used to dynamically grow an array. It is useful for building dynamic lists or queues. AAdd() is similar to ASize() but only adds one element at a time. ASize() can grow or shrink an array to a specified size. AAdd() however, has the advantage that it can assign a value to the new element, while ASize() cannot.
Examples
The following example creates the array aArray1 and adds the value in the variable cName to it.
aArray1 := {}
AAdd(aArray1, cName)
____________________________
Related Topics: