Skip to content

Instantly share code, notes, and snippets.

@bitmappergit
Last active April 15, 2019 18:01
Show Gist options
  • Save bitmappergit/0e7e30321f447397f0b10f50f25ff42b to your computer and use it in GitHub Desktop.
Save bitmappergit/0e7e30321f447397f0b10f50f25ff42b to your computer and use it in GitHub Desktop.
let rec beer = function
| 0 -> print_string "No more bottles of beer on the wall, no more bottles of beer.\n" ;
print_string "Take one down, and pass it around, 99 bottles of beer on the wall.\n\n"
| 1 -> print_string "1 bottle of beer on the wall, 1 bottle of beer.\n" ;
print_string "Take it down, and pass it around, no more bottles of beer on the wall.\n\n"
| n -> Printf.printf "%d bottles of beer on the wall, %d bottles of beer.\n" n n ;
Printf.printf "Take one down, and pass it around, %d bottles of beer on the wall.\n\n" (n - 1);
beer (n - 1)
in beer 99 ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment