Catch
Catch(expr)returns the value argument of the first
Throw(value)generated in the evaluation ofexpr.
Catch(expr, form)returns value from the first
Throw(value, tag)for whichformmatchestag.
Catch(expr, form, f)returns
f(value, tag).
Examples
Exit to the enclosing Catch as soon as Throw is evaluated:
>> Catch(r; s; Throw(t); u; v)tDefine a function that can “throw an exception”:
>> f(x_) := If(x > 12, Throw(overflow), x!)The result of Catch is just what is thrown by Throw:
>> Catch(f(1) + f(15))overflow
>> Catch(f(1) + f(4))25Implementation status
- ✅ - full supported