Skip to content
Turtle Kitty edited this page Aug 9, 2015 · 2 revisions

return

This operator terminates a function and returns the value given. As functions return their final expression's value by default, this operator is only necessary for early termination.

(fun foo (x)
    (when (= x 0)
        (return 42))
    (* x 7))

(foo 0) -> 42
(foo 2) -> 14
Clone this wiki locally