4.15.6 Interrupting Execution

There exist more drastic means of interrupting the normal control flow. To invoke a recursive top-level, use:

     ?- break.

To exit from Prolog, use:

     ?- halt.

To exit from Prolog with return code Code, use:

     ?- halt(Code).

To abort the execution of the current query and return to the top-level, use:

     ?- abort.
Please note: halt/[0,1] and abort/0 are implemented by raising a reserved exception, which has a handler at the top level of development systems and executables built with the spld tool. Thus they give the opportunity for cleanup goals (see call_cleanup/2) to run.

Send feedback on this subject.