Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Procedural Programming > Flow Control >

Abort

Abort[]
generates an interrupt to abort a computation.
  • You can call Abort anywhere within a computation. It has the same effect as an interactive interrupt in which you select the abort option.
  • You can use Abort as an "emergency stop" in a computation.
  • Once Abort has been called, Mathematica functions currently being evaluated return as quickly as possible.
  • In an interactive session, the final result from an aborted computation is $Aborted.
  • You can use CheckAbort to "catch" returns from an abort.
Abort execution of a sequence of commands:
A function for doing fixed-point iteration that aborts if the value gets above a certain limit:
An unstable iteration:
A stable iteration to approximate GoldenRatio:
Abort the numerical solution of a differential equation if the solution would become complex:
Abort execution of a sequence of commands:
 
A function for doing fixed-point iteration that aborts if the value gets above a certain limit:
In[1]:=
Click for copyable input
An unstable iteration:
In[2]:=
Click for copyable input
Out[2]=
A stable iteration to approximate GoldenRatio:
In[3]:=
Click for copyable input
Out[3]=
 
Abort the numerical solution of a differential equation if the solution would become complex:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
New in 2
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team