Skip to content

Instantly share code, notes, and snippets.

@thieux
Created May 18, 2017 11:32
Show Gist options
  • Save thieux/6a63c48a1e704d6833e35fff1e5af140 to your computer and use it in GitHub Desktop.
Save thieux/6a63c48a1e704d6833e35fff1e5af140 to your computer and use it in GitHub Desktop.
(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