AFILL() Fill an array with a specified value ------------------------------------------------------------------------------ Syntax AFILL(<aTarget>, <expValue>, [<nStart>], [<nCount>]) --> aTarget Arguments <aTarget> is the array to be filled. <expValue> is the value to be placed in each array element. It can be an expression of any valid data type. <nStart> is the position of the first element to be filled. If this argument is omitted, the default value is one. <nCount> is the number of elements to be filled starting with element <nStart>. If this argument is omitted, elements are filled from the starting element position to the end of the array. Returns AFILL() returns a reference to <aTarget>. Description AFILL() is an array function that fills the specified array with a single value of any data type (including an array, code block, or NIL) by assigning <expValue> to each array element in the specified range. Warning! AFILL() cannot be used to fill multidimensional arrays. Clipper implements multidimensional arrays by nesting arrays within other arrays. Using AFILL() with a multidimensional array will overwrite subarrays used for the other dimensions of the array. Examples . This example, creates a three-element array. The array is then filled with the logical value, (.F.). Finally, elements in positions two and three are assigned the new value of true (.T.): LOCAL aLogic[3] // Result: aLogic is { NIL, NIL, NIL } AFILL(aLogic, .F.) // Result: aLogic is { .F., .F., .F. } AFILL(aLogic, .T., 2, 2) // Result: aLogic is { .F., .T., .T. } Files Library is CLIPPER.LIB.
See Also: AADD() AEVAL() DBSTRUCT() DIRECTORY()
Pingback: C5_STORE | Viva Clipper !