Created
August 1, 2016 21:21
-
-
Save ElvisLives/19cc3806f694a11ea3a7a10480b8f2f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Fizzbuzz | |
open System | |
let rangeOfNumbers = [1..100] | |
let isDivisible number x = (x % number) = 0 | |
let fizzAndBuzz x = (isDivisible(3) x && isDivisible(5) x) | |
let answer (number:int) = | |
match number with | |
| x when fizzAndBuzz number = true -> printfn "FizzBuzz" | |
| x when isDivisible(3) x = true -> printfn "Fizz" | |
| x when isDivisible(5) x = true -> printfn "Buzz" | |
| _ -> printfn "%A" number | |
for number in rangeOfNumbers do | |
answer number | |
Console.ReadKey() |> ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment