Skip to content

Instantly share code, notes, and snippets.

@jonelf
Created November 27, 2013 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonelf/7678519 to your computer and use it in GitHub Desktop.
Save jonelf/7678519 to your computer and use it in GitHub Desktop.
FizzBuzz
[<EntryPoint>]
let main _=
for n in 1..100 do
let s = seq {
if n % 3 = 0 then yield "Fizz"
if n % 5 = 0 then yield "Buzz" }
if Seq.isEmpty s then printf "%d"n
printfn "%s"(s |> String.concat "")
0
@forki
Copy link

forki commented Nov 27, 2013

:thumbsup for not introducing the n %15 = 0 as a special case.

@jonelf
Copy link
Author

jonelf commented Nov 27, 2013

That's exactly what made me do it! Couldn't find an example without the n % 15 and I've always seen that as part of this "stupid" assignment.

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