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 FormulaOne (F1)

(Correct Lyrics)

Date:01/14/07
Author:anonymous
URL:n/a
Comments:0
Info:http://www.f1compiler.com
Score: (2.99 in 101 votes)
//////////////////////////////////////////////////////////////////////////////////////////////////
// F1 Program to generate the lyrics of the song 99 Bottles of Beer
//
// To execute the program, run the query
//
//      BottlesOfBeer(99)
//
//////////////////////////////////////////////////////////////////////////////////////////////////

proc BottlesOfBeer(i:<I[0..99]) iff
    if i > 2 then
        Print( i, ' bottles of beer on the wall, ', i,' bottles of beer.\n') &
        Print('Take one down and pass it around, ',i-1,' bottles of beer on the wall.\n\n') &
        BottlesOfBeer(i-1)
    elsif i = 2 then    
        Print('2 bottles of beer on the wall, 2 bottles of beer.\n') &
        Print('Take one down and pass it around, 1 bottle of beer on the wall.\n\n') &
        BottlesOfBeer(i-1) 
    else
        Print('1 bottle of beer on the wall, 1 bottle of beer.\n') &
        Print('Take one down and pass it around, no more bottles of beer on the wall.\n\n') &
        Print('No more bottles of beer on the wall, no more bottles of beer.\n') & 
        Print('Go to the store and buy some more, 99 bottles of beer on the wall.\n')
    end

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: