Undefined value
In computing (particularly, in programming), undefined value is a condition where an expression does not have a correct value, although it is syntactically correct. An undefined value must not be confused with empty string, boolean "false" or other "empty" (but defined) values. Depending on circumstances, evaluation to an undefined value may lead to exception or undefined behaviour, but in some programming languages undefined values can occur during a normal, predictable course of program execution.
Dynamically typed languages usually treat undefined values explicitly when possible. For instance, Perl has undef
operator which can "assign" such value to a variable. In other type systems an undefined value can mean an unknown, unpredictable value, or merely a program failure on attempt of its evaluation. Nullable types offer an intermediate approach; see below.
Examples
The value of a partial function is undefined when its argument is out of domain of definition. This include numerous arithmetical cases such as division by zero, square root or logarithm of a negative number etc.; see NaN.