Skip to content

@greghelton /unless.clj
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Clojure: define the unless function and use in examples
(defn unless [test expr] (if-not (eval test) (eval expr)))
(prn (unless (odd? 11) (str "it's good to be " 11)))
(prn (unless (odd? 12) (str "it's good to be " 12)))
(defn only-if-even [x] (unless (odd? x) (str "it's good to be " x)))
(prn (str 6 " " (only-if-even 6)))
(prn (str 5 " " (only-if-even 5)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.