This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Built-in Functions / Programming / Flow Control /

Catch

FilledSmallSquare Catch[expr] returns the argument of the first Throw generated in the evaluation of expr.

FilledSmallSquare Catch[expr, form] returns value from the first Throw[value, tag] for which form matches tag.

FilledSmallSquare Catch[expr, form, f] returns f[value, tag].

FilledSmallSquare Catch[expr, ... ] always returns the value of expr if no Throw was generated during the evaluation.

FilledSmallSquare form can be any expression, and is often a pattern.

FilledSmallSquare tag in Throw[value, tag] is re-evaluated every time it is compared to form.

FilledSmallSquare See Section 2.6.9.

FilledSmallSquare See also: Check, CheckAbort, Reap.

FilledSmallSquare New in Version 1; modified in 3.

Further Examples