To exit from Prolog, type your end-of-file character at the main Prolog prompt. (The standard end-of-file character is ^d for UNIX and ^z for Windows.)
| ?- ^D
Alternatively, you can exit from Prolog by typing halt. followed by a carriage return at the main Prolog prompt:
| ?- halt.<RET>
<RET> stands for the Return key on your terminal. Note that a period followed by a <RET> must always be typed after a goal. The <RET> will usually not be shown explicitly but will be assumed in the examples that follow.
If all else fails, you can always use a ^c interrupt followed by an e to exit.