DEV Community

loading...

Discussion on: FizzBuzz challenge in as many languages as possible

Collapse
brianverm profile image
Brian Vermeer 🧑🏼‍🎓🧑🏼‍💻

Language: Haskell
Code:

fizzBuzzer :: Int -> String
fizzBuzzer i | (i `mod` 15) == 0 = "FizzBuzz"
       | (i `mod` 5) == 0 = "Buzz"
       | (i `mod` 3) == 0 = "Fizz"
       | otherwise = show i

fizzBuzz :: IO()
fizzBuzz = mapM_ print [ fizzBuzzer i | i <- [1..100]]