News for hackers. Stuff that matters.
Re:Streem – a new programming language from Matz by ghuntley on Thursday December 11, 2014 @10:40PM (#8738472)
Using F# pattern matching:

    let buzzer number =
       match number with
       | i when i % 3 = 0 && i % 5 = 0 -> "FizzBuzz"
       | i when i % 3 = 0 -> "Fizz"
       | i when i % 5 = 0 -> "Buzz"
       | i -> (sprintf "%i" i)

    for i = 1 to 100 do
        printfn "%s" (buzzer i)

There are no comments on this comment yet.