ASize()
Increase or decrease the size of an array.
Syntax
ASize(<aTarget>, <nLength>) --> aTarget
Arguments
<aTarget> is the array to increase or decrease in size.
<nLength> is the new size of the array.
Returns
ASize() returns a reference to the target array, <aTarget>.
Description
ASize() is an array function that changes the size of the <aTarget> array. The array is shortened or lengthened to match the specified length. If the array is shortened, elements at the end of the array are lost. If the array is lengthened, new elements are added to the end of the array and assigned NIL.
ASize() is similar to AAdd() which adds one new element to the end of an array and optionally assigns a new value at the same time.
Examples
This example creates an array of 1 element, increases it by 3 elements, then decreases it again by 1 element:
aArray := { 1 }
ASize(aArray, 4)
* Result: aArray is { 1, NIL, NIL, NIL }
ASize(aArray, 1)
* Result: aArray is { 1 }
____________________________
Related Topics: