Skip to content

Instantly share code, notes, and snippets.

@Crowbrammer
Created September 20, 2021 17:21
Show Gist options
  • Save Crowbrammer/63834dc01e5a92b97e0be9128a701281 to your computer and use it in GitHub Desktop.
Save Crowbrammer/63834dc01e5a92b97e0be9128a701281 to your computer and use it in GitHub Desktop.
(defn fizzbuzz
"If div by 3, fizz; if by div by 5, buzz;
if div by both, fizzbuzz"
[num]
(if (zero? (mod num 3))
(if (zero? (mod num 5))
"fizzbuzz"
"fizz")
(when (zero? (mod num 5))
"buzz")))
(map #(println % ":"(fizzbuzz %)) (range 50))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment