= Simple assign

 = (assign)
 Simple assign--binary                           (Assignment)
------------------------------------------------------------------------------
 Syntax

     <idVar> = <exp>

 Type

     All

 Operands

     <idVar> is a valid variable identifier of any storage class,
     including a field variable.  If <idVar> is not visible or does not
     exist, a private variable is created and assigned the result of <exp>.

     <exp> is the expression whose result is assigned to <idVar>.

 Description

     The simple assignment operator (=) assigns a value to a variable.  It is
     identical in operation to the STORE command that initializes a single
     variable and must be specified as a program statement.  The inline
     assignment operator (:=) is like the = operator except that you can
     specify it within expressions.  If you specify the simple assign
     operator (=) within an expression, it is interpreted as the equality (=)
     operator.

     Note:  You cannot initialize a specific variable using the simple
     assign operator (=) in a declaration statement.  Only the inline assign
     (:=) operator can be used for this purpose.

     If the reference to <idVar> is ambiguous (i.e., not declared at compile
     time and not explicitly qualified with an alias), <idVar> is always
     assumed to be MEMVAR.  At runtime, if no private or public variable
     exists with the specified name, a private variable is created.  To
     assign a field variable with the = operator, you must declare the field
     variable name in a FIELD statement or refer to the field name prefaced
     by the FIELD-> alias or the name of the work area.

 Examples

     .  These examples are valid simple assignment statements:

        nValue = 25
        nNewValue = SQRT(nValue) ** 5
        nOldValue = nValue

     .  In this example, the two lines are equivalent:

        FIELD->CustAge = 20
        REPLACE CustAge WITH 20

See Also: ++ — := = (compound) STORE*

 

Advertisements