throw/1

raises an error and returns to the closest point which can catch that leap.

throw(+Term)

throw/1 stops execution of the current executed procedure and returns to the closest point which can catch that leap. Such a catch-point can be created with 'catch(Goal, CatchMask, RecoverGoal)'. If CatchMask is unifiable with Term then the result of catch/3 is the result of RecoverGoal.
If no catch-point can be found throw/1 quits MINERVA.

Arguments

Term                   term

Examples

catch(throw(true),X,write('return to catch-point')). Succeeds with substitution X <- true and
writes 'return to catch-point' to the current outputstream.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

abort/0, break/0, call/1, fcall/1, catch/3, ','(conjunction)/2, '!'(cut)/0, ';'(disjunction)/2, fail/0, true/0, halt/0/1, '->'(if-then)/2, ';'(if-then-else)/2, '\+'(not provable)/1, once/1, repeat/0.


Darueber read on...