Duplicate a nested or multidimensional array

     ACLONE(<aSource>) --> aDuplicate


     <aSource> is the array to be duplicated.


     ACLONE() returns a duplicate of <aSource>.


     ACLONE() is an array function that creates a complete duplicate of the
     <aSource> array.  If <aSource> contains subarrays, ACLONE() creates
     matching subarrays and fills them with copies of the values in the
     <aSource> subarrays.  ACLONE() is similar to ACOPY(), but ACOPY() does
     not duplicate nested arrays.


     .  This example creates an array then duplicates it using
        ACLONE().  The first array is then altered, but the duplicate copy is

        LOCAL aOne, aTwo
        aOne := { 1, 2, 3 }         // Result: aOne is {1, 2, 3}
        aTwo := ACLONE(aOne)        // Result: aTwo is {1, 2, 3}
        aOne[1] := 99               // Result: aOne is {99, 2, 3}
                                   // aTwo is still {1, 2, 3}

 Files   Library is CLIPPER.LIB.



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.