[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
PrologFail
The example below shows the use of fail. If you would remove it, only one father would be shown.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
PrologFail
(Prolog) fail
The predicate fail always fails, which is used to force backtrackting.The example below shows the use of fail. If you would remove it, only one father would be shown.
DOMAINS
name = symbol
PREDICATES
nondeterm father(name,name)
nondeterm everybody
CLAUSES
father(leonard,katherine).
father(carl,jason).
father(carl,marily).
everybody:-
father(X,Y),
write(X, " is ",Y, "'s father\n"),
fail.
everybody.
GOAL
everybody.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
