Exceptions/Catch an exception thrown in a nested call: Difference between revisions

Content added Content deleted
(Added Wren)
(Add APL)
Line 218: Line 218:
'''par''' clause, then all parallel the threads are terminated and the
'''par''' clause, then all parallel the threads are terminated and the
program continues in the parent thread. <!-- example needed -->
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}}==
=={{header|AutoHotkey}}==