Share via


STORE Command

Stores data to a variable, to an array, or to an array element.

STORE eExpression TO VarNameList | ArrayNameList-or-
VarName | ArrayName = eExpression

Parameters

  • eExpression
    Specifies an expression whose value is stored to the variable, array, or array element. If the variable doesn't exist, it is created and initialized to eExpression. An array must be previously defined with DIMENSION. STORE replaces the value in an existing variable, array, or array element with the new value.

  • VarNameList
    Specifies a list of variables or array elements to which eExpression is stored. Separate the names or array elements with commas.

  • ArrayNameList
    Specifies a list of names of existing arrays to which eExpression is stored. Separate array names with commas.

    STORE initializes every element in the arrays to the specified value if SET COMPATIBLE is OFF. STORE stores the specified value to memory variables of the specified names if SET COMPATIBLE is ON, overwriting any existing arrays that have those names.

Remarks

An alternative to STORE is the equal sign (=) assignment operator. The variable, array, or array element must be on the left side of the equal sign and its value on the right side.

Dates can be stored directly to variables, arrays, or array elements by using braces:

STORE {^1998-12-25} TO gdXMas

The maximum number of variables or arrays you can create is listed in the Visual FoxPro System Capacities topic. The limit can be increased or decreased in your Visual FoxPro configuration file. For more information on configuring Visual FoxPro, see Customizing the Visual FoxPro Environment.

Example

STORE DATE( ) TO gdDate
STORE 50 TO gnNumeric
STORE 'Hello' TO gcCharacter
STORE .T. TO glLogical
STORE $19.99 TO gyCurrency

DIMENSION gaMyArray(2,2)
SET COMPATIBLE OFF
STORE 2 TO gaMyArray

CLEAR
DISPLAY MEMORY LIKE g*

See Also

Reference

DIMENSION Command

SET COMPATIBLE Command

Visual FoxPro System Capacities

Other Resources

Commands (Visual FoxPro)

Language Reference (Visual FoxPro)