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 Felix

Date:08/11/11
Author:Marinus Oosters
URL:n/a
Comments:0
Info:http://felix-lang.org
Score: (3.50 in 2 votes)
var bottles:int = 99;

proc bottletxt(b:int) {
    match b with
    | -1       => { print "99 bottles"; }
    | 0        => { print "No more bottles"; }
    | 1        => { print "1 bottle"; }
    | 2 .. 100 => { print b; print " bottles"; }
    endmatch;
}

proc line1(b:int) {
    bottletxt b;
    println " of beer on the wall,";
}

proc line2(b:int) {
    bottletxt b;
    println " of beer,";
}

proc line3(b:int) {
    println if b == 0 then 
       "Go to the store and buy some more,"
    else
       "Take one down and pass it around,"
    endif;
}

proc line4(b:int) {
    bottletxt b;
    println " of beer on the wall.\n";
}

while { bottles >= 0 } {
    line1 bottles;
    line2 bottles;
    line3 bottles;
    --bottles;
    line4 bottles;
};

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: