Icon+Unicon/Intro: Difference between revisions

Content added Content deleted
Line 278: Line 278:
Terminates the current program and writes the result of expression to a file (&errout by default).
Terminates the current program and writes the result of expression to a file (&errout by default).
====error trapping====
====error trapping====
The keyword &error is normally zero, but if set to a positive value, this sets the number of fatal errors that are tolerated and converted to expression failure; the value of &error is decremented if this happens. Therefore the now-common TRY-CATCH behaviour can be written as:
The keyword '&error' is normally zero, but if set to a positive value, this sets the number of fatal errors that are tolerated (i.e. converted to expression failure). The value of &error is decremented each time this happens. Therefore the now-common TRY-CATCH behaviour can be written as:


Various idiomatic simplifications can be applied depending on your needs.
Various idiomatic simplifications can be applied depending on your needs.

====error throwing====
====error throwing====
Errors can be thrown using the function runerr(number, variable)
Errors can be thrown using the function runerr(number, variable)