Hello, World! in Prolog

Example for versions B-Prolog 7.4 #3, Poplog 15.5 (Prolog), gprolog 1.3.0, swipl 5.6.x

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:

Hello, World!

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.