Created
May 18, 2017 11:32
-
-
Save thieux/6a63c48a1e704d6833e35fff1e5af140 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(comment defn fizz-buzz [n] | |
(if (= 0 (mod n 15)) | |
"fizzbuzz" | |
(if (= 0 (mod n 3)) | |
"fizz" | |
(if (= 0 (mod n 5)) | |
"buzz" n)))) | |
(comment defn fizz-buzz [n] | |
(if (= 0 (mod n 15)) | |
"fizzbuzz") | |
(if (= 0 (mod n 3)) | |
"fizz") | |
(if (= 0 (mod n 5)) | |
"buzz" n)) | |
(defn fizz-buzz [n] | |
(cond | |
(= 0 (mod n 15)) "fizzbuzz" | |
(= 0 (mod n 3)) "fizz" | |
(= 0 (mod n 5)) "buzz" | |
true n)) | |
(println (fizz-buzz 1)) | |
(println (fizz-buzz 3)) | |
(println (fizz-buzz 5)) | |
(println (fizz-buzz 15)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment