Created
September 10, 2017 23:28
-
-
Save lilactown/44a8fcc9b3804a817d1dab4879992ced to your computer and use it in GitHub Desktop.
FizzBuzz in Reason
This file contains hidden or 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
let fizzbuzz num => { | |
let shouldFizz = num mod 3 == 0; | |
let shouldBuzz = num mod 5 == 0; | |
switch (shouldFizz, shouldBuzz) { | |
| (true, true) => "FizzBuzz" | |
| (true, false) => "Fizz" | |
| (false, true) => "Buzz" | |
| (false, false) => string_of_int num | |
} | |
}; | |
for num in 0 to 30 { | |
print_endline (fizzbuzz num) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment