Next / Previous / Index / TCC Help System / Publications / Site map / NM Tech homepage

How does the null value work in Icon?

Tech Computer Center logo

When you've declared a variable but before you've ever put anything in it, that variable is said to have the null value. If you try to perform computations on a null value, your program will terminate abnormally. This protects you from logic errors caused by using a variable that has never been defined.

You can test to see whether a variable is undefined (that is, whether it has a null value) by using the ``/'' and ``\'' operators:

There is a special predefined variable, ``&null'', so this expression

    foo  :=  &null
causes the variable foo to become undefined; any old value it might have had is discarded.
Next: Text processing in Icon
See also: A tutorial for the Icon programming language
Previous: Using the basic Icon types
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Computer Center: Help System
TCC Publications
Home: About New Mexico Tech

John Shipman, john@nmt.edu

Last updated: 1998/02/08 23:14:08 UT
URL: http://www.nmt.edu/tcc/help/lang/icon/null.html