AFill Function | |
Fill array elements with a specified value.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION AFill(
aTarget AS ARRAY,
uValue AS USUAL,
nStart AS USUAL,
nCount AS USUAL
) AS ARRAY
public static Array AFill(
Array aTarget,
[DefaultParameterValueAttribute(0, 1)] Usual uValue,
[DefaultParameterValueAttribute(0, 1)] Usual nStart,
[DefaultParameterValueAttribute(0, 1)] Usual nCount
)
Request Example
View SourceParameters
- aTarget
- Type: Array
The array to fill. - uValue
- Type: Usual
The value to place in each array element. - nStart
- Type: Usual
The starting element.
A negative value starts from the end.
If nCount is positive, the default value is 1; if nCount is negative, the default value is the length of the array.
- nCount
- Type: Usual
The number of elements to process from nStart.
A negative value starts from the end.
The default is all elements to the end of the array.
Return Value
Type:
Array
A reference to
aTarget.
Remarks
AFill() fills the specified array with a single value of any data type by assigning uValue to each array element in the specified range.
Using AFill with a multidimensional array could overwrite subarrays used for the other dimensions of the array.
Examples
This example creates a 3-element array.
The array is then filled with the logical value FALSE. Finally, elements in positions 2 and 3 are assigned the new value TRUE:
1LOCAL aLogic[3]
2AFill(aLogic, FALSE)
3AFill(aLogic, TRUE, 2, 2)
This example fills up the individual rows of a multidimensional array:
1LOCAL a2[3][3]
2AFill(a2[1], "One")
3AFill(a2[2], "Two")
4AFill(a2[3], "Three")
See Also