Skip to content

Instantly share code, notes, and snippets.

@Ellyll
Created Nov 15, 2016
Embed
What would you like to do?
F# FizzBuzz attempt
let fizzBuzz n =
if n % 3 = 0 && n % 5 = 0 then "FizzBuzz"
elif n % 3 = 0 then "Fizz"
elif n % 5 = 0 then "Buzz"
else (sprintf "%d" n)
let a = seq { 1 .. 20 }
a
|> Seq.iter (fun n -> printfn "%d: %s" n (fizzBuzz n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment