real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Rexx

Author:Lee Stewart
Score: (3.42 in 31 votes)
/* Rexx Version of the Bottles program */
/* by Lee Stewart ( */
   Trace Off;
   Do Forever;
      Do i = 99 To 1 By -1;
         If i > 1 Then pl = 's';
                  Else pl = '';
         Say i 'bottle'pl 'of beer on the wall,' i 'bottle'pl 'of beer';
         Say 'Take one down, pass it around';
      Say 'No more bottles of beer on the wall, no more bottles of beer';
      Say 'Go to the store and buy some more';

Download Source | Write Comment

Alternative Versions

Recursive MethodLaurent KUPERBERG11/26/090
now w/ "xx bottles of beer on the wall"R. Mark Enright10/23/080


>>  Dave Salt said on 04/22/08 17:48:35

Dave Salt The REXX code appears slightly more complicated than it needs to be (even though what's shown is already very simple). TRACE OFF is the default and therefore doesn't need to be specified, and a closing semi-colon is assumed at the end of each line of REXX and therefore also doesn't need to be specified.

>>  Michael Buckley said on 04/23/08 07:10:00

Michael Buckley The code results in the following

99 bottles of beer on the wall, 99 bottles of beer
Take one down and pass it around

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around

etc. The second line should actually be "Take one down and pass it around, xx bottles of beer on the wall"

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!




Security Code: