Exceptions: Difference between revisions

Content added Content deleted
imported>Arakov
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 3,536: Line 3,536:


Here's an example of all this.
Here's an example of all this.
<syntaxhighlight lang="ecmascript">var intDiv = Fn.new { |a, b|
<syntaxhighlight lang="wren">var intDiv = Fn.new { |a, b|
if (!(a is Num && a.isInteger) || !(b is Num && b.isInteger)) Fiber.abort("Invalid argument(s).")
if (!(a is Num && a.isInteger) || !(b is Num && b.isInteger)) Fiber.abort("Invalid argument(s).")
if (b == 0) Fiber.abort("Division by zero error.")
if (b == 0) Fiber.abort("Division by zero error.")