Exceptions
throw
(let throw (fun (_x) (...)))
throw takes a value as its argument and return it to be used by try
Author: @SuperFola
Parameter
_x: the value to return
Example
(let error (throw "cannot divide by zero"))
return
(let return (fun (_y) (...)))
return takes a value as its argument and return it to be used by try
Author: @SuperFola
Parameter
_x: the value to return
Example
(let value (return (/ 1 x)))
try
(let try (fun (_either _continue _handle) (...)))
Takes a value either returned by throw or return and apply a given on it if it’s an error or not
Author: @SuperFola
Parameters
_either: the value to test_continue: the success handler_handle: the error handler
Example
(let invert (fun (x)
(if (= x 0)
(throw "cannot divide by zero")
(return (/ 1 x)))))
(try (invert 0)
(fun (inverted) (print inverted))
(fun (err) (print err)))
Prev
EventsNext
Functional