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 Tutor

Date:04/20/05
Author:Chris Lopez
URL:n/a
Comments:2
Info:n/a
Score: (2.50 in 2 votes)
*--- Chris Lopez - lopez@huey.vp.uiuc.edu ---*
*--- start of code ---*
define
        maxbeer = 99
        origin:n1
        beer            $$ # of beers remaining
        atloc           $$ where to start writing this line
        nextlin(x) = (x <= (x+100) $mod$ 3200)
*
mode    rewrite
calc    beer  <= maxbeer
        atloc <= 1
loop
.       at      nextlin(atloc)
.       showt   beer,2
.       * Warning: trailing space on following line
.       write    bottles of beer on the wall,
.       showt   beer,2
.       write    bottles of beer.
.       at      nextlin(atloc)
.       write   Take one down, pass it around.
outloop ((beer<=beer-1) < 2)
.       showt   beer-1,2
.       write    bottles of beer.
endloop
*
write    1 bottle of beer.
at      nextlin(atloc)
write    1 Bottle of beer on the wall,  1 bottle of beer.
         Take it down, pass it around, no bottles of beer on the wall.
*
pause   keys=all
jumpout q

*--- end of code ---*

Download Source | Write Comment

Alternative Versions

Comments

>>  Joe Stanton said on 07/19/06 04:00:14

Joe Stanton Nice, but for that trailing space line you should use the classic triple dollar sign comment, which is self-documenting...

>>  Joe Stanton said on 06/09/08 04:20:06

Joe Stanton Uh, idiot, that's some version of TUTOR, not TenCORE. There is no triple dollar sign comment character in classic TUTOR. Of course classic TUTOR does not have the "origin" verb. This must be a NovaNet version or something else.

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: