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 Algol60

(Succinct clear example!)

Date:01/05/07
Author:Tom Jennings
URL:n/a
Comments:0
Info:n/a
Score: (2.96 in 164 votes)
'begin'

'comment'
    99 Bottles of Beer on the Wall
    written in Algol60, for the a60 interpreter
    by Erik Schoenfelder.

    Lower case, whitespace, ASCII, literal strings,
    implementation character set, etc, and other    
    modern conceits are ahistoric and waste cards and tape.

    Tom Jennings 5 Jan 2006
;

'integer' 'procedure' bottles(n);
'value' n;
'integer' n;
'begin'
    'if' n < 1 'then' outstring(1, "no more ") 'else' outinteger(1, n);
    'if' n = 1 'then' outstring(1, "bottle") 'else' outstring(1, "bottles");
    outstring(1, " of beer");
'end';



'comment' Here is main.  ;

'integer' i;

    'for' i := 99 'step' -1 'until' 1 'do' 'begin'
        bottles(i); outstring(1, " on the wall, ");
        bottles(i); outstring(1, "\n");
        outstring(1, "take one down and pass it around, ");
        bottles(i - 1); outstring(1, " on the wall.\n");
    'end';

'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: