Next: , Previous: , Up: ref-ere   [Contents][Index]


4.15.7 Interrupting Execution

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

?- break.

See mpg-ref-break.

To exit from Prolog, use:

?- halt.

To exit from Prolog with return code Code, use:

?- halt(Code).

See mpg-ref-halt.

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

?- abort.

See mpg-ref-abort.

Please note: halt/[0,1] and abort/0 are implemented by throwing 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.