4.37 User Top-level Manipulation
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • User Top-level Manipulation
          • break/0
          • abort/0
          • halt/0
          • halt/1
          • prolog/0
          • expand_query/4
          • expand_answer/2
    • Packages
Availability:built-in
abort
Abort the Prolog execution and restart the top level. If the -t toplevel command line option is given, this goal is restarted instead of entering the default interactive top level.

Aborting is implemented by throwing the reserved exception '$aborted'. This exception can be caught using catch/3, but the recovery goal is wrapped with a predicate that prunes the choice points of the recovery goal (i.e., as once/1) and re-throws the exception. This is illustrated in the example below, where we press control-C and‘a'. See also section 4.10.1.

?- catch((repeat,fail), E, true).
^CAction (h for help) ? abort
% Execution Aborted