Skip to content

Instantly share code, notes, and snippets.

@tcshao
Last active April 27, 2019 10:52
Show Gist options
  • Save tcshao/4114529 to your computer and use it in GitHub Desktop.
Save tcshao/4114529 to your computer and use it in GitHub Desktop.
FizzBuzz in F#
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
@jrg94
Copy link

jrg94 commented Aug 16, 2018

Hey! Would you be interested in sharing this solution with the Sample Programs repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment