Language ML
| Date: | 04/20/05 |
| Author: | Jong-Won Choi |
| URL: | n/a |
| Comments: | 4 |
| Info: | n/a |
| Score: |
(* ML version of 99 bottles of beer *)
(* - Using pattern of functions parameters *)
(* and Recursion(like other functional programming langauges) *)
(* Written by Jong-Won Choi(jwchoi@gsen.goldstar.co.kr) *)
(* Nov 13, 95 *)
fun NinetyNineBottlesOfBeer(0) =
print("\n No more bottles of beer on the wall\n")
| NinetyNineBottlesOfBeer(1) =
(print("\n 1 bottle of beer on the wall, 1 bottle of beer.");
print("\n Take one down and pass it around.");
NinetyNineBottlesOfBeer(0))
| NinetyNineBottlesOfBeer(NumberOfBottles:int) =
(print("\n "); print(NumberOfBottles);
print(" bottle of beer on the wall, ");
print(NumberOfBottles);
print(" bottle of beer.");
print("\n Take one down and pass it around.");
NinetyNineBottlesOfBeer(NumberOfBottles - 1));
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
Great work!