SWI-Prolog 5.6.53 Reference Manual: Section 4.11

## 4.11 The `block' control-structure

The block/3 predicate and friends have been introduced before ISO compatible catch/3 exception handling for compatibility with some Prolog implementation. The only feature not covered by catch/3 and throw/1 is the possibility to execute global cuts. New code should use catch/3 and throw/1 to deal with exceptions.

block(+Label, +Goal, -ExitValue)
  Execute Goal in a block. Label is the name of the block. Label is normally an atom, but the system imposes no type constraints and may even be a variable. ExitValue is normally unified to the second argument of an exit/2 call invoked by Goal.
exit(+Label, +Value)
  Calling exit/2 makes the innermost block which Label unifies exit. The block's ExitValue is unified with Value. If this unification fails the block fails.
fail(+Label)
  Calling fail/1 makes the innermost block which Label unifies fail immediately. Implemented as

      fail(Label) :- !(Label), fail.

!(+Label)
  Cut all choice-points created since the entry of the innermost block which Label unifies.