You are here

Working with equations : Intermediate variables

Intermediate variables


Local variable assignments can be made before an expression, separated from the expression by a comma.  The expression returning the value of the element must come at the end.  The local variables can be used in the expression, often to simplify it.

In the following example, the local variable q is assigned a value, then the main expression follows after a comma, with q being used to simplify what would otherwise be an extremely complex expression:


if ((T>Tmin)&&(T<Tmax)) then

   (((T-Tmin)^q) * (Tmax-T)) / (((Topt-Tmin)^q) * (Tmax-Topt))




There are four parameters influencing this expression, T, Topt, Tmin, and Tmax, through influence arrows in the normal way.  The assignment of a value to q is a purely local affair.

Note that the assignment of the local variable uses a single = sign. This is not to be confused with the double == of an equality test.

In: Contents >> Working with equations >> Components of an equation