A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Fizz Buzz in F# page! Here, you'll find the source code for this program as well as a description of how the program works.
module FizzBuzz =
let (|DivisibleBy|_|) divisor number =
if number % divisor = 0 then Some() else None
let fizzBuzzOf number =
match number with
| DivisibleBy 3 & DivisibleBy 5 -> "FizzBuzz"
| DivisibleBy 3 -> "Fizz"
| DivisibleBy 5 -> "Buzz"
| _ -> string number
let printUpTo n =
Seq.init n (fun i -> i + 1) |> Seq.map fizzBuzzOf |> Seq.iter (printfn "%s")
[<EntryPoint>]
let main _ =
FizzBuzz.printUpTo 100
0
Fizz Buzz in F# was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.