Language groovy
Date: | 08/14/05 |
Author: | Akihito Tsukamoto |
URL: | n/a |
Comments: | 2 |
Info: | http://groovy.codehaus.org/ |
Score: | (3.02 in 66 votes) |
def bottlesOfBeer(n) { return "" + (n==0 ? "no more" : n) + (n==1 ? " bottle" : " bottles") + " of beer"; } 99.downto(1) { println bottlesOfBeer(it)+" on the wall, " + bottlesOfBeer(it) + "!" println "Take one down, pass it around," println bottlesOfBeer(it-1)+" on the wall!" println "" }
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
Brad said on 03/08/08 22:27:19
Nice tight, readable code. I'm looking at various scripting languages for my own personal use when I need to hack quick utilities. This sort of terseness and readability appeal to me.
James said on 06/30/10 14:53:57
Love this Language!!!!!!!!!!!!