Skip to content

Instantly share code, notes, and snippets.

@aeppert
Created June 7, 2016 15:06
Show Gist options
  • Select an option

  • Save aeppert/82869fab6603f76d4a54d88eca913933 to your computer and use it in GitHub Desktop.

Select an option

Save aeppert/82869fab6603f76d4a54d88eca913933 to your computer and use it in GitHub Desktop.
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 ;;
do_fizzbuzz 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment