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

The joys of failure in Icon

Tech Computer Center logo

An Icon expression can produce any number of results---zero, one, two, a million. The results are produced in sequence, one at a time.

The evaluation of expressions in Icon depends on the context from which the expression is evoked:

The fact that expressions can fail actually makes it easier to handle exceptional cases. Suppose you are writing a procedure that computes the root of an equation, but some equations have no root. Rather than having to figure out what value you should return in that case, the procedure can simply fail.

You can test to see if a procedure failed. For example:

    if  not Some_Proc ( )  then...
where ``Some_Proc'' is some procedure that may fail.
Next: Using generators in Icon
See also: A tutorial for the Icon programming language
Previous: Branching in Icon
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: 1996/01/06 21:12:57 UT
QR two-dimensional bar code