Functions and Directives

Function ASize() Foundation

Changes the number of elements in an array.

ASize( <aArray>, <nElements> ) --> aArray
<aArray> is the array whose size is changed.
<nElements> is a numeric value which determines the number of elements included in the array <aArray>.

ASize() returns the reference to <aArray>.


The array function ASize() increases or decreases the number of elements in an array. When the array is lengthened, the new elements are at the end of the array and have the value NIL. If the array is shortened, the elements at the end of the array are deleted and their contents are lost.

Another function which changes the size of an array is AAdd() which attaches a single array element at the end and optionally assigns it a value. The contents of array elements can also be manipulated with the functions AIns() and ADel(), which do not change the size of the array.

The number of elements in an array is not limited by Xbase++.

Dynamically change the size of an array using ASize()

// The example shows the effect of ASize() on an array. 

   LOCAL aArray := {"A","B","C"} 

   ASize( aArray, 5 )      // aArray is: {"A","B","C",NIL,NIL} 
   ASize( aArray, 2 )      // aArray is: {"A","B"} 



If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.