Writes the term X to the current output stream. write takes account of current operator declarations - thus an infix operator will be printed out between its arguments. write represents lists as a comma separated sequence of elements enclosed in square brackets.
Succeeds only once.
writeln(X) writes the term X to the current output stream, followed by a new line character. writeln(X) can be used as an alternative to write(X), nl.
Examples
?- write( 1+1 ).
1 + 1
yes
?- write( '+'(1,1) ).
1 + 1
yes
?- write(hello), nl, write(world), nl.
hello
world
yes
?- writeln(hello), writeln(world).
hello
world
yes