Expressions and the $Null Property
An object that has not been assigned a value, or whose value is unknown, is considered to be $Null. For example, at the start of an application session, global variables do not have an assigned value, so each is considered $Null. If the name of an object with an unassigned or unknown value is used as an atomic expression, the expression is considered to be $Null.
The $Null property is special in two ways:
- Any arithmetic or functional expression that contains a $Null value expression evaluates to $Null.
- Any logic expression that contains a $Null value expression is considered logically false.
For example, if the variable Salary is $Null, then
Salary * 1.1 evaluates to $null, and Salary = 20000 is logically false.
However, you can successfully check if an expression is $Null. If Salary is $Null, then
Salary is $Null is logically true and Salary is not $Null is logically false.
Notice that conditional expressions involving the system variable $Null cannot use an = (equals) or <> (not equals) operator; instead, you must use the operator IS [NOT]. The use of IS and IS NOT emphasizes that $Null is a property and not a value.
Note: $Null can also be written Null.