CheckAbort
Usage
• CheckAbort[expr, failexpr]对expr求值,如果发生一个中止则返回failexpr。
Notes
• CheckAbort 吸收任何它处理的中止,并不进一步传播。 • CheckAbort在AbortProtect中使用. • CheckAbort 有属性 HoldAll.
Further Examples
Here is an example that evaluates Abort[].
In[1]:=
|

Out[1]=
|
The effect of CheckAbort here is to change the return value of the calculation.
In[2]:=
|

Out[2]=
|
CheckAbort can also be used to contain an abort in part of the calculation.
In[3]:=
|


Out[3]=
|
Here is a more complicated example using CheckAbort.
In[4]:=
|



Out[4]=
|
The same effect can be achieved using Throw and Catch. CheckAbort is more general in that it will also receive aborts from sources other than Abort, such as aborts entered using the keyboard.
In[5]:=
|



Out[5]=
|
|