AEvalA Function (Array, ICodeblock) | |
Execute a code block for each element in an array and assign the return value to each element in the array.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION AEvalA(
aArray AS ARRAY,
cbBlock AS ICodeblock
) AS ARRAY
public static Array AEvalA(
Array aArray,
ICodeblock cbBlock
)
Request Example
View SourceParameters
- aArray
- Type: Array
The array to traverse. - cbBlock
- Type: ICodeblock
The code block to execute.
Return Value
Type:
Array
A reference to
aArray.
Remarks
AEvalA() is similar to AEval() in that they both evaluate a code block once for each element of an array,
passing the element value as an argument.
The difference is that while AEval() ignores the return value of the code block,
AEvalA() assigns the return value to the array element.
See AEval() for details.
Examples
This example uses AEvalA() to create an array of file names in lowercase:
1FUNCTION Start()
2 LOCAL aFiles := Directory("*.dbf")
3 LOCAL nTotal AS SHORTINT
4 AEvalA(aFiles,{|aDBFFile| LOWER(PadR(aDBFFile[F_NAME], 10))})
See Also