Language Natural
Date: | 04/20/05 |
Author: | Chris Bednara |
URL: | n/a |
Comments: | 3 |
Info: | n/a |
Score: | ![]() |
* PGM-ID: BEER * AUTHOR: CHRIS BEDNARA * COMMENT: NATURAL '99 BOTTLES OF BEER ON THE WALL' CODE * *------------------------------------------------------- DEFINE DATA LOCAL 01 #BOTTLES (I2) END-DEFINE * FOR #BOTTLES 99 TO 2 STEP -1 IF #BOTTLES < 98 WRITE #BOTTLES ' BOTTLES OF BEER ON THE WALL' WRITE ' ' END-IF * WRITE #BOTTLES ' BOTTLES OF BEER ON THE WALL' WRITE #BOTTLES ' BOTTLES OF BEER' WRITE 'TAKE ONE DOWN, PASS IT AROUND' END-FOR * WRITE '1 BOTTLE OF BEER ON THE WALL' WRITE ' ' WRITE '1 BOTTLE OF BEER ON THE WALL' WRITE '1 BOTTLE OF BEER' WRITE 'TAKE IT DOWN, PASS IT AROUND' WRITE 'NO MORE BOTTLES OF BEER ON THE WALL' WRITE ' ' WRITE 'NO MORE BOTTLES OF BEER ON THE WALL' WRITE 'NO MORE BOTTLES OF BEER' WRITE 'GO TO THE STORE AND BUY SOME MORE' WRITE '99 BOTTLES OF BEER' END WRITE 'TAKE ONE DOWN, PASS IT AROUND'
Download Source | Write Comment
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!
Comments
Here's my version (linesize limit (72 chars on mainframe) respected. Hash convention respected
DEFINE DATA LOCAL
1 #BOTTLES (N2) INIT <99>
END-DEFINE
REPEAT
WRITE #BOTTLES 'Bottles of beer on the wall,'
#BOTTLES 'Bottles of beer'
#BOTTLES := #BOTTLES -1
IF #BOTTLES = 0 THEN
WRITE 'Take one down and pass it around,'
#BOTTLES 'bottles of beer'
ELSE
WRITE 'Take one down and pass it around, no more bottles of beer'
END-IF
WRITE ' '
UNTIL #BOTTLES = 0
END-REPEAT
WRITE 'No more bottles of beer on the wall, no more bottles of beer. '
WRITE 'Go to the store and buy some more,'
'99 bottles of beer on the wall'
END
DEFINE DATA LOCAL
1 #BOTTLES (N2) INIT <99>
END-DEFINE
REPEAT
WRITE #BOTTLES 'Bottles of beer on the wall,'
#BOTTLES ' Bottles of beer'
#BOTTLES := #BOTTLES -1
IF #BOTTLES = 0 THEN
WRITE 'Take one down and pass it around,'
#BOTTLES 'bottles of beer'
ELSE
WRITE 'Take one down and pass it around, no more bottles of beer'
END-IF
WRITE ' '
UNTIL #BOTTLES = 0
END-REPEAT
WRITE 'No more bottles of beer on the wall, no more bottles of beer. '
WRITE 'Go to the store and buy some more,'
'99 bottles of beer on the wall'
END