Exceptions: Difference between revisions

m
Spelling/grammar/aesthetics
(→‎{{header|J}}: Added throwing of an error.)
m (Spelling/grammar/aesthetics)
Line 1:
{{Task}}
{{Control Structures}}
 
This task is to give an example of an exception handling routine and to "throw" a new exception.
=={{header|Ada}}==
Line 40 ⟶ 39:
=={{header|C++}}==
 
C++ has no finally construct. Instead you can do this in the destructor of an object on the stack, which will be called
destructor of an object on the stack, which will be called
if an exception is thrown.
 
Line 119 ⟶ 117:
=={{header|Forth}}==
Forth's exception mechanism is, like most things in Forth, very simple but powerful.
CATCH captures the data and return stack pointers, then exectutesexecutes an execution token.
THROW conditionally throws a value up to the most recent CATCH, restoring the stack pointers.
 
Line 201 ⟶ 199:
eventSetup = true;
}
 
 
=={{header|Perl}}==
Line 297 ⟶ 294:
quux()
 
Before Python 2.5 it was not possible to use finally and except together. (It was necessary to nest a separate ''try''...''except'' block inside of your ''try''...''finally'' block).
 
=={{header|Raven}}==
Anonymous user