next up previous contents
Next: Input of Prolog Up: Another Interlude: Input/Output Previous: Input/ Output and

The End of File Marker

When read/1 encounters the end of a file it returns the Prolog atom

 
end_of_file

So we can rewrite test/0:

 
test:-

read(X),

\+(X = end_of_file),

double(X,Y),

write(Y),

nl,

test.

and now we have our end-of-input marker as the atom end_of_file.

Paul Brna
Mon May 24 20:14:48 BST 1999