Show/Hide Toolbars

XSharp

NoteThis command is not available in the Core and Vulcan dialects
NoteThis command is defined in a header file and will be preprocessed by the X# preprocessor to a function call. If you disable the standard header (-nostddefs) files then this command will not be available. If you tell the compiler to use a different standard header file (-stddef ) then this command may also be not available

Purpose

Assign a value to one or more variables.

Syntax

STORE <uValue> TO <idVarList>

Arguments

<uValue>A value to assign to the specified variables.
TO <idVarList>Defines a list of one or more variables that are assigned the value <uValue>.  If any variable reference in the list is ambiguous (that is, not declared at compile time or not explicitly qualified with an alias), it is assumed to be MEMVAR.  If any variable in the list is not visible or does not exist, a private variable is created using <uValue>.

Description

The STORE command is defined using the assignment operator (:=).  

Notes

Assigning a value to an entire array: In XSharp, neither the STORE command nor the assignment operators can assign a single value to an entire array.  Use the AFill() function for this purpose.

Examples

These statements create and assign values to undeclared private variables:

 

STORE "string" TO cVar1, cVar2, cVar3
cVar1 := "string2"
cVar2 := _MEMVAR->cVar1

 

These statements assign multiple variables using both STORE and the inline assignment operator (:=).  The methods produce identical code:

 

STORE "value" TO cVar1, cVar2, cVar3
cVar1 := cVar2 := cVar3 := "value"

 

These statements assign values to the same field referenced explicitly with an alias.  The first assignment uses the field alias (_FIELD->), where the second uses the actual alias name:

 

USE sales NEW
STORE 1200.98 TO _FIELD->CustBal
STORE 1200.98 TO Sales->CustBal

See Also

AFill(), , LOCAL, PRIVATE, PUBLIC, RELEASE, REPLACE, RESTORE, SAVE, STATIC