Hello, World! in Prolog
This example doesn’t need any facts or rules to be evaluated. The query is executed in interactive mode, and results in the following output:
First line is the actual output of
write predicate, and second line is the result of query evaluation.
Note that replacing single-quotes with double-quotes makes Prolog output the string as an array of ASCII-codes of individual characters:
| ?- write("Hello, World!").
write('Hello, World!'), nl.