repeat/0 — always succeed upon backtracking
repeat/0 always succeeds, even during backtracking. This behavior is useful for implementing loops which repeatedly perform some side-effect.
repeat/0 is defined by the following clauses:
repeat. repeat :- repeat.
The following procedure will repeat forever, reading in an expression and printing out its value.
loop :- repeat, read(Expression), Value is Expression, write(' Value = '), write(Value), nl, fail.