Created
March 22, 2015 14:28
-
-
Save karahiyo/08620dd2261c7b28729b 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
| module FizzBuzz where | |
| -- | FizzBuzz test | |
| -- >>> fizzbuzz 1 | |
| -- "1" | |
| -- | |
| -- >>> fizzbuzz 3 | |
| -- "Fizz" | |
| -- | |
| -- >>> fizzbuzz 5 | |
| -- "Buzz" | |
| -- | |
| -- >>> fizzbuzz 15 | |
| -- "FizzBuzz" | |
| -- | |
| fizzbuzz :: Int -> String | |
| fizzbuzz n | |
| | n `mod` 15 == 0 = "FizzBuzz" | |
| | n `mod` 5 == 0 = "Buzz" | |
| | n `mod` 3 == 0 = "Fizz" | |
| | otherwise = show n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment