Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: exit Statement Up: Statements Previous: return Statement


fail Statement

The fail statement is used to indicate an error and provides an alternate way to return from a function. Typically a function returns by either executing the last statement of the function or an explicit return statement. There are two forms of fail you can use to return from a function:

fail expression

fail
Typically, the expression is a string describing the error condition, and when no expression is provided, the last fail value generated is used, if available.

An additional feature of fail values, i.e. the values produced and returned by fail statements, are automatically propagated. This is true at two different levels. When fail values are used in expressions (including function calls), the result is a fail value which is immediately generated without evaluation of the expression. Additionally if the fail value returned from a function call to an executing function, the result of the function which received the fail value will in turn be a fail value if the fail is not handled. A fail value is considered ``handled'' if its type has been checked, e.g. via type_name() or is_fail(). (See Chapter 9.1, page [*], for a complete description of fail.)


next up previous contents index
Next: exit Statement Up: Statements Previous: return Statement   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15