Click or drag to resize

ASize Function (Array, DWord)

X#
Grow or shrink an array.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION ASize(
	aTarget AS ARRAY,
	dwLength AS DWORD
) AS ARRAY
Request Example View Source

Parameters

aTarget
Type: Array
The array to grow or shrink.
dwLength
Type: DWord
The new size of the array.

Return Value

Type: Array
A reference to aTarget.
Remarks
ASize() changes the actual length of aTarget.
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 a single new element to the end of an array and optionally assigns a new value at the same time. Note that ASize() is different from AIns() and ADel(), which do not actually change the array's length.
Examples
These examples demonstrate adding new elements and deleting existing elements:
X#
1LOCAL aArray AS ARRAY
2aArray := {1}            // aArray is {1}
3ASize(aArray, 3)        // aArray is {1, NIL, NIL}
4ASize(aArray, 1)        // aArray is {1}
See Also