Undefined is a system constant that returns a special value used internally by Analytica to denote that an attribute value is not yet set, that a value is not yet computed, or that an optional parameter is omitted. It is related to, but not the same as Null, the latter being used by Analytica models to denote that data is missing, unavailable or not applicable. For example, there is a difference between "the value has not yet been computed" and "the value has been computed, and the result is Null".
As a user of Analytica, you don't need to even know that this value exists, since you use Null in your own work. There are only a few exceptional cases when the awareness of the undefined value might be relevant, see below.
When a variable evaluates to Undefined, the Calculate button reappears, since this special value means that the value has not yet been computed. When the value Undefined occurs in the cell of an array, the cell displays as a blank cell.
Testing for Undefined
The IsUndef function returns true if an atomic value is Undefined or Null, so you would need to use IsUndef(x) and x <> Null to distinguish. This odd behavior is this way because it is felt that users should not have to understand or be conscious of the difference between Undefined and Null.
You can also test for Undefined more directly using IsNotSpecified(x). This function exists to test whether an optional function parameter was omitted, but this turns out to be equivalent to testing whether it is equal to Undefined. Notice that passing the value Null to an optional parameter is not the same as omitting the parameter.
Calculating optional parameters
One case where Undefined proves useful is when you have logic that computes the value to be passed to a parameter of a function, but your logic may determined that it should omit the parameter. By passing Undefined to the optional parameter, you effectively omit the parameter.
Debugging dynamic loops
In models with complex Dynamic loops, a computation may terminate before a variable in a dynamic loop has been computed completely for all time points. This may be because it isn't the variable requested, and only some time-slices of the variable in question were needed, or it may be because the computation terminated prematurely due to an error or user abort. In either case, when debugging you may find it helpful to view
value of x for some variable
x (i.e., creating another variable to temporarily hold the result). When you view this value, the cells that have not yet been computed appear as blank cells, but contain the value Undefined.
Note that if you try to view the result of a the variable in question directly, the computation to compute the remaining time slices will occur before displaying the value. Hence, to view the partially computed value, you must use
value of x.
Testing Attribute values
With the exception of the value and probValue attributes, there is no Analytica expression that can tell the difference between "(attribute of object) has no value" and "(attribute of object) has the value Null. There are some ways to tell the difference from typescript.