Export (0) Print
Expand All
Expand Minimize

DECLARE Command

Creates a one- or two-dimensional array.

NoteNote

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

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.

NoteNote

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

Community Additions

ADD
Show:
© 2014 Microsoft