Next / Previous / Index / ITC 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 Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
Home: About New Mexico Tech

John Shipman,
Last updated: 1998/02/08 23:14:08 UT
QR two-dimensional bar code