hello world prolog
Sure! Here's a simple "Hello, World!" program in Prolog:
hello_world :-
write('Hello, World!'), nl.
In this program, we define a predicate called hello_world
. The write
goal is used to print the string "Hello, World!" to the console, and nl
is used to output a newline character. To run the program, you can simply call the hello_world
predicate:
?- hello_world.
When you execute this query in a Prolog interpreter, it will print "Hello, World!" to the console.
I hope this code snippet helps! If you have any further questions, feel free to ask.