DECLARE Command

Creates a one- or two-dimensional array.

Note

DECLARE is identical in operation and similar in syntax to the DIMENSION command. For more information, see DIMENSION Command.

DECLARE ArrayName1 (nRows1 [, nColumns1]) 
   [, ArrayName2 (nRows2 [, nColumns2])] ...

Remarks

You can use either brackets or parentheses to enclose the expressions in DECLARE. For example, the following two commands create identical arrays:

DIMENSION gaArrayOne(10), gaArrayTwo[2,4], gaArrayThree(3,3)
DIMENSION gaArrayOne[10], gaArrayTwo(2,4), gaArrayThree[3,3]

When the size of an array is increased or decreased when SET COMPATIBLE is set to ON or DB4, the value of each element in the array is reinitialized to .F.

Note

Visual FoxPro arrays are one-based - the first element, row, or column of an array is specified with the number 1. (Arrays in other programming languages may be zero-based; the first element, row, or column of an array is specified with the number 0.)

See Also

Reference

APPEND FROM ARRAY Command
COPY TO ARRAY Command
GATHER Command
PRIVATE Command
PUBLIC Command
SCATTER Command
SET COMPATIBLE Command
STORE Command

Other Resources

Commands (Visual FoxPro)
Language Reference (Visual FoxPro)