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 Natural

Date:04/20/05
Author:Chris Bednara
URL:n/a
Comments:3
Info:n/a
Score: (2.00 in 23 votes)
* 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

Alternative Versions

Comments

>>  Bau de jogos said on 11/24/06 20:35:48

Bau de jogos what does a code that uses manual write buy us? :(

>>  wllacer said on 10/29/09 14:50:56

wllacer Rather bad Natural Code.
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

>>  wllacer said on 10/29/09 14:53:35

wllacer Opps. Formatting went to the flush
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

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: