This task is about arrays.

For hashes or associative arrays, please see Creating an Associative Array.

For a definition and in-depth discussion of what an array is, see Array.



Task

Show basic array syntax in your language.

Basically, create an array, assign a value to it, and retrieve an element   (if available, show both fixed-length arrays and
dynamic arrays, pushing a value into it).

Please discuss at Village Pump:   Arrays.

Please merge code in from these obsolete tasks:

   Creating an Array
   Assigning Values to an Array
   Retrieving an Element of an Array


Related tasks

   Collections
   Creating an Associative Array
   Two-dimensional array (runtime)


;
;       Arrays for DBL version 4 by Dario B.
;
 
.DEFINE NR,5
 
        RECORD
 
VNUM1,  5D8             ;array of number
VNUM2,  [5]D8           ;array of number
VNUM3,  [5,2]D8         ;two-dimensional array of number
 
VALP1,  5A10            ;array of strings
VALP2,  [5]A10          ;array of strings
VALP3,  [5,2]A10        ;two-dimensional array of strings
 
VALP4,  [NR]A10         ;array of strings
 
    PROC
;------------------------------------------------------------------
 
        ;Valid uses of arrays 
        VNUM1(1)=12345678
 
        VNUM2(1)=VNUM1(1)               ; = 12345678
        VNUM2[2]=VNUM1(1)               ; = 12345678
 
        VNUM2[3]=VNUM2[1](3:2)          ; = 34
 
        VNUM3[1,1]=1
        VNUM3[1,2]=2
        VNUM3[2,1]=3
 
 
        VALP1(1)="ABCDEFGHIJ"
 
        VALP2(2)=VALP1(1)               ; = "ABCDEFGHIJ"
        VALP2[2]=VALP1(1)               ; = "ABCDEFGHIJ"
 
        VALP2[3](3:2)=VALP2[1](3:2)     ; = "  CD      "
 
        VALP3[1,1]="ABCDEFGHIJ"
        VALP3[1,2]=VALP3[1,1]           ;= "ABCDEFGHIJ"
        VALP3[2,1](3:2)=VALP3[1,2](3:2) ;= "   CD      "
 
        VALP4[1]="ABCDEFGHIJ"
 
        ;Clear arrays
        CLEAR VNUM1(1:5*8),VNUM3(1:5*2*8)
        VNUM2(1:5*8)=
        CLEAR VALP1(1:5*8),VALP2(1:5*10)
        VALP3(1:5*2*10)=