IF Computer > MINERVA > Manual > Reference > Predicates > Logic and control > fail/0

fail/0

MINERVA
ifcomputer logo
f
Expert Services on the Web

forces a failure.

fail/0

fail/0 fails always. It can force backtracing.
Conjuncted subgoals that follow after fail/0 can never be executed.
Be careful with calling fail/0 after a never-ending loop (for example see repeat/0).

Examples

write('this is going to fail'), fail. Fails with output on the current outputstream
'this is going to fail'.
repeat,write(endless),nl,fail. writes infinitely on the current outputstream
'endless'.

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, true/0, halt/0/1, '->'(if-then)/2, ';'(if-then-else)/2, '\+'(not provable)/1, once/1, repeat/0, throw/1.

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/logic_and_control/fail/print_de.html
published 2008/12/1 update 2001/2/7 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS