> cat testloop.p % File: testloop.p % show how to read and loop; and get exit gracefully testloop :- read(X), X \== 'quit', write(X), nl, testloop. testloop. > > > pl Welcome to SWI-Prolog (Version 2.7.16) Copyright (c) 1993-1996 University of Amsterdam. All rights reserved. For help, use ?- help(Topic). or ?- apropos(Word). 1 ?- ['testloop.p']. testloop.p compiled, 0.00 sec, 1,304 bytes. Yes 2 ?- testloop. |: duck. duck |: chicken. chicken |: quit. Yes 3 ?- halt. >