Arrays

An array is an ordered series of data values, called elements, which are referenced by number. Because arrays exist in memory, they provide fast data access and easy manipulation. You can easily specify, locate, or manipulate elements in an array.

Arrays have the same scoping options as variables. A single Visual FoxPro array may contain any and all data types as values.

Create an array with the DIMENSION or DECLARE command and assign value to each element by identifying the element by array name and position. The following example creates a two-dimensional array of five rows and two columns, then assigns a value to the second column of the first row:

DIMENSION ArrayName[5,2]
ArrayName[1,2] = 966789

You can also use SCATTER, GATHER, COPY TO ARRAY, and APPEND FROM ARRAY to move field values to and from array elements. For more information about using arrays in your application, see Data Transfer and Arrays.

See Also

Variables | APPEND FROM ARRAY Command | COPY TO ARRAY Command | DECLARE Command | DIMENSION Command | GATHER Command | SCATTER Command | Data Storage Containers