Click or drag to resize

AReplicate Function

X#
To create an array and fill its elements with a default value.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax
 FUNCTION AReplicate(
	xFill AS USUAL,
	nElements AS DWORD
) AS ARRAY
Request Example View Source

Parameters

xFill
Type: Usual
The value with which to fill the array.
nElements
Type: DWord
The size of the array.

Return Value

Type: Array
An array nElements elements long, each element containing xFill.
Remarks
Examples
This example creates an array of 10 elements and fills it with zeros:
X#
1aNewArray := AReplicate(0, 10)
This example creates an array of 5 elements and fills it with "Empty" strings:
X#
1aEmptyArray := AReplicate("Empty", 5)
See Also