Created
June 12, 2011 06:39
-
-
Save philtomson/1021309 to your computer and use it in GitHub Desktop.
FizzBuzz OCaml
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 i = match ((i mod 3), (i mod 5)) with | |
| (0,0) -> "fizzbuzz" | |
| (_,0) -> "buzz" | |
| (0,_) -> "fizz" | |
| (_,_) -> string_of_int i ;; | |
let do_fizzbuzz n = for i = 1 to n do | |
Printf.printf "%s\n" (fizzbuzz i) | |
done ;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment