Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language JavaFX

Date:04/13/09
Author:Filip Dreger
URL:n/a
Comments:0
Info:http://javafx.com
Score: (1.82 in 11 votes)
function bottles (n:Integer){
    if (n == 1) then "1 bottle"
        else if (n == 0) then "no more bottles"
        else "{n} bottles";
}

for (x:Integer in [99..0 step -1]) {
    println (
        "{bottles(x).replaceFirst("n", "N")} of beer on the wall, {bottles(x)} of beer."
    );
    println (
        if (x!=0)
            then "Take one down and pass it around, {bottles(x-1)} of beer on the wall."
            else "Go to the store and buy some more, 99 bottles of beer on the wall."
    );
    println ("");
}

Download Source | Write Comment

Alternative Versions

Comments

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!

Name:

eMail:

URL:

Security Code:
  
Comment: