# = (Variable Assignment)

## Purpose:

Assigns the value of an expression to a variable.

## Syntax:

variable = <expr>

 variable - A variable. - Any expression evaluating to a scalar, series, or table.

## Returns:

Nothing, the result of the expression is assigned to the variable.

a = 5

b = 10

a * b

Returns 50.

## Example:

c = {1, 2, 3}

a * c

Returns the series {5, 10, 15}.

## Example:

Assigning elements to the empty series, {}, removes data points. For example:

a = {1, 2, 3, 4, 5}

a = {}

Returns the series {1, 2, 4, 5}.

## Remarks:

Multiple return assignments are support. For example, the expression:

(u, w, v) = svd(a)

assigns the variables u, w, and v.

The = operator can assign a series to a Window, however, the Window formula remains unchanged. For example:

W1: 1..100

W2: integ(w1)

W1 = gnorm(100,1)

The original ramp data in W1 is replaced with random data. The formula of W1 is unchanged, but W2 automatically recalculates because the series in W1 changed. This behavior is very useful with cyclical Worksheets. For example:

W1: W2

W2: W1 - delay(W1,10)

If your Calculation Settings has Cyclical Window Formulae enabled, the mutually dependent Windows will recalculate as many times as specified by the Iteration Count or until calc(-1) is executed. However, since W1 is initially empty, there is no data to evaluate. To start the iteration, simply assign a series to W1.

W1 = 1..10

The := operator assigns both a formula and series to a Window. For example:

W1 := gnorm(100,1)

sets the data and the formula of W1.

The = operator performs a standard variable assignment. Standard variables do not propagate changes. For example:

a = 5

b = a * a

a = 10

The variable b retains the original value 25.

Use the := operator to create "hot variables". Hot variables propagate changes. For example:

a := 5

b := a * a

a := 10

The := operator creates hot variables a and b. Variable b now automatically updates whenever a changes, thus b has the value 100.

See == to compare two expressions.

:=

:

==

Assignment Operators

CALC

SETHOTVARIABLE

SETVARIABLE