Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

90% of /prog/ can't write FizzBuzz

Name: The antagonist 2008-04-25 12:38

Prove me wrong

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

Name: Anonymous 2008-05-07 19:47

>>217
//fixed it

let fizzbuzz =
    let range = seq {1 .. 100}
    let modcheck y =
        match y with
        | _ when y % 3 + y % 5 = 0 -> printfn "FizzBuzz"
        | _ when y % 5 = 0 -> printfn "Buzz"
        | _ when y % 3 = 0 -> printfn "Fizz"
        | _ -> printfn "%d" y
    range |> Seq.iter modcheck
  

//F# is beautiful so fuck off, every other piece of code in this thread is pretty much the same level of readability or worse.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List