repeat/0

Module: builtins

repeat/0 — always succeed upon backtracking

ISO Standard Predicate

FORMS

repeat

DESCRIPTION

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.

EXAMPLES

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.

SEE ALSO