Exceptions/Catch an exception thrown in a nested call: Difference between revisions
Exceptions/Catch an exception thrown in a nested call (view source)
Revision as of 15:05, 12 January 2021
, 3 years agoAdd APL
(Added Wren) |
Not a robot (talk | contribs) (Add APL) |
||
Line 218:
'''par''' clause, then all parallel the threads are terminated and the
program continues in the parent thread. <!-- example needed -->
=={{header|APL}}==
{{works with|Dyalog APL}}
<lang APL>:Namespace Traps
⍝ Traps (exceptions) are just numbers
⍝ 500-999 are reserved for the user
U0 U1←900 901
⍝ Catch
∇foo;i
:For i :In ⍳2
:Trap U0
bar i
:Else
⎕←'foo caught U0'
:EndTrap
:EndFor
∇
⍝ Throw
∇bar i
⎕SIGNAL U0 U1[i]
∇
:EndNamespace</lang>
{{out}}
<pre> Traps.foo
foo caught U0
ERROR 901
foo[3] bar i
∧
</pre>
=={{header|AutoHotkey}}==
|