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 ELAN

Date:04/20/05
Author:Michael Hocke
URL:n/a
Comments:0
Info:n/a
Score: (2.95 in 20 votes)
// By Michael Hocke (2002.06.24)

INT VAR number of bottles;

PROCEDURE print how many bottles are on the wall (INT CONST number):

  print number;
  print bottle;
  print trailing text.

  print number:
    IF number = 0 THEN
      put ("No")
    ELSE
      put (number)
    END IF.

  print bottle:
    out ("Bottle");
    IF no <> 1 THEN
      out ("s")
    END IF.

  print trailing text:
    out (" of beer").

END PROCEDURE print how many bottles are on the wall;

say hello;
print song;
say goodbye.

say hello:
  putline ("99 Bottles of Beer");
  putline ("==================");
  line.

print song:
  FOR number of bottles FROM 99 DOWNTO 1 REPEAT
    print first line;
    print second line;
    print third line
  END REPEAT.

say goodbye:
  line;
  putline ("=====================");
  putline ("You need a ride home?");
  line.

print first line:
  print how many bottles are on the wall (number of bottles);
  out (" on the wall, ");
  print how many bottles are on the wall (number of bottles);
  line.

print second line:
  putline ("Take one down and pass it around,").

print third line:
  print how many bottles are on the wall (number of bottles - 1);
  putline (" on the wall");
  line.

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: