Click or drag to resize

ArrayCreate Function (DWord)

X#
Create an uninitialized, one-dimensional array.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax
 FUNCTION ArrayCreate(
	dwElements AS DWORD
) AS ARRAY
Request Example View Source

Parameters

dwElements
Type: DWord
The number of elements in the array.

Return Value

Type: Array
Remarks
ArrayCreate() returns an uninitialized array with only one dimension.
To create uninitialized multidimensional arrays, see ArrayNew().
Examples
This example creates a one-dimensional array of five elements using ArrayCreate(), then shows the equivalent action by assigning a literal array of NIL values:
X#
1LOCAL aArray AS ARRAY
2aArray := ArrayCreate(5)
3aArray := {NIL, NIL, NIL, NIL, NIL}
This example creates an array of numbers and puts values in the elements:
X#
1FUNCTION Start()
2    LOCAL aArray AS ARRAY
3    aArray := ArrayCreate(3)
4    ArrayPut(aArray, 1, 1)
5    ArrayPut(aArray, 2, 10)
6    ArrayPut(aArray, 3, 100)
See Also