repeat
always succeeds even when an attempt is made to re-satisfy it.
Examples
?- repeat.
yes;
yes;
yes;
yes;
yes;
yes;
yes
write_to_file(X) :-
open('io_test.tmp', write, Z),
set_output(Z),
write(X),
close(Z),
set_output('user_output').
read_from_file :-
open('io_test.tmp', read, Z),
set_input(Z),
print_first_sentence,
close(Z).
print_first_sentence :-
repeat,
get_char(C),
write(C),
C=='.',
!.
?- write_to_file('The first sentence. The second sentence.').
yes
?- read_from_file.
The first sentence.
yes