9.2 Fail

There is a new global variable

  • fail

    in GAP 4. It is intended as a return value of a function for the case that it could not perform its task. For example, Inverse returns fail if it is called with a singular matrix, and Position returns fail if the second argument is not contained in the list given as first argument.

    GAP 3 handled such situations by either signalling an error, for example if it was asked for the inverse of a singular matrix, or by (mis)using false as return value, as in the example Position. Note that in the first example, in GAP 3 it was necessary to check the invertibility of a matrix before one could safely ask for its inverse, which meant that roughly the same work was done twice.

    [Top] [Previous] [Up] [Next] [Index]

    GAP 4 manual
    February 2000