ASSIGNMENT statement

Changes the value of a variable.

Syntax

variable = value;
Components

variable

The name of a variable defined with a Create Variable statement. The variable must be within the scope of the current code block.

value

An expression that evaluates to a value of the type specified for the variable when it was created, or a type that is implicitly converted to the correct data type (see Implicit Data Type Conversions for more information).

Restrictions

See Also

Examples

The following example creates a variable called ii, which is visible to the entire function. Assignment statements then assign values to the variable throughout the function.

CREATE FUNCTION MyFunction(InputPar FLOAT) RETURNS FLOAT
   CREATE VARIABLE FLOAT res = SIN(InputPar) + COS(InputPar);
   CREATE VARIABLE INTEGER ii; 
   IF InputPar > 0 THEN
      ii = ROUND(InputPar, 0);
      WHILE(ii > 0) DO
         res = res + ii * sin(ii / 2);
         ii = ii - 1;
      END; 
   ELSE
      ii = ROUND(-InputPar, 0);
      WHILE(ii > 0) DO
         res = res + ii * cos(ii / 2);
         ii = ii - 1 ;
      END; 
   END; 
   RETURN res; 
END FUNCTION;