Chapter 7. Advanced Programming with GEL
Prev |  | Next

# Chapter 7. Advanced Programming with GEL

## Обработка ошибок

If you detect an error in your function, you can bail out of it. For normal errors, such as wrong types of arguments, you can fail to compute the function by adding the statement `bailout`. If something went really wrong and you want to completely kill the current computation, you can use `exception`.

For example if you want to check for arguments in your function. You could use the following code.

    function f(M) = (
      if not IsMatrix (M) then (
        error ("M not a matrix!");
        bailout
      );
      ...
    )

Prev |  | Next
Lvalues | Home | Toplevel Syntax