Prolog system is straightforward. From one person to other person, the precise details of Prolog will vary. Prolog will produce a number of lines of headings in the starting, which is followed by a line. It contains just
The above symbol shows the system prompt. The prompt is used to show that the Prolog system is ready to specify one or more goals of sequence to the user. Using a full stop, we can terminate the sequence of goals.
?- write('Welcome to Javatpoint'),nl,write('Example of Prolog'),nl.
nl indicates 'start a new line'. When we press 'return' key, the above line will show the effect like this:
Welcome to Javatpoint
Example of Prolog
?- prompt shows the sequence of goal which is entered by the user. The user will not type the prompt. Prolog system will automatically generate this prompt. It means that it is ready to receive a sequence of goals.
The above example shows a sequence of goals entered by the user like this:
write('Welcome to Javatpoint'), write('Example of Prolog'), nl(twice).
Consider the following sequence of goals:
write('Welcome to Javatpoint'),nl,write('Example of Prolog'),nl.
The above sequence of goals has to succeed in order to be succeeded.
All these goals will simply achieve by the Prolog system by outputting the line of text to the screen of the user. To show that the goals have succeeded, we will output yes.
The Prolog system predefined the meanings of nl and write. Write and nl are called as built-in predicates.
Halt and statistics are the two other built-in predicates. In almost all Prolog versions, these predicates are provided as standard.
The above output ends with Yes. Yes, specify that the goal has succeeded, as halt, statistics, and many other built-in predicates always do. When they evaluate, their values produce, which lies in the side-effects.
'Query' is a sequence of one or more goals. These goals are entered by the user at the prompt. In this tutorial, we are generally using the 'sequence of goals' term.