Created
February 21, 2018 14:30
-
-
Save kiyui/98434661f43ad74f4aab52fcf680233f to your computer and use it in GitHub Desktop.
Fizz Buzz
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
/** | |
* Was watching this video by Tom Scott;- | |
* https://www.youtube.com/watch?v=QPZ0pIK_wsc | |
* And decided to try out the problem in ReasonML | |
*/ | |
for (i in 1 to 100) { | |
let i = float(i); | |
let output = switch (mod_float(i, 3.0), mod_float(i, 5.0)) { | |
| (0.0, 0.0) => "FizzBuzz" | |
| (0.0, _) => "Fizz" | |
| (_, 0.0) => "Buzz" | |
| _ => string_of_float(i) | |
}; | |
print_endline(output); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment