Fill an array with a specified value

     AFILL(<aTarget>, <expValue>,
        [<nStart>], [<nCount>]) --> aTarget


     <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.


     AFILL() returns a reference to <aTarget>.


     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.


     .  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.



One response to “C5_AFILL

  1. Pingback: C5_STORE | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.