-
-
Save jrgcubano/7343c4eebcc9a569045f to your computer and use it in GitHub Desktop.
FizzBuzz in F#
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
let fizzBuzz x = | |
match x with | |
| _ when (x % 15) = 0 -> "FizzBuzz" | |
| _ when (x % 3) = 0 -> "Fizz" | |
| _ when (x % 5) = 0 -> "Buzz" | |
| _ -> "" | |
let fizzBuzzTo max = | |
[1..max] | |
|> List.iter (fun number -> printfn "%d %s" number (fizzBuzz number)) | |
|> ignore | |
fizzBuzzTo 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment