Exceptions: Difference between revisions
Content added Content deleted
(Added code example, J) |
(→{{header|J}}: Added throwing of an error.) |
||
Line 140: | Line 140: | ||
=={{header|J}}== |
=={{header|J}}== |
||
u :: v |
u :: v |
||
Program<tt> u :: v </tt>executes <tt>u</tt> and provides its result as output unless an error occurs. In case of error, the result of <tt>v</tt> is provided instead. |
Program<tt> u :: v </tt>executes <tt>u</tt> and provides its result as output unless an error occurs. In case of error, the result of <tt>v</tt> is provided instead.<br> |
||
An error condition can be forced in explicit definition by use of<tt> assert. </tt> as seen below. |
|||
uWillFail =: 3 : 0 |
|||
assert. 0 |
|||
) |
|||
=={{header|Java}}== |
=={{header|Java}}== |