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 Doc1 PCE

Date:04/20/05
Author:Donavan Hoepcke
URL:n/a
Comments:0
Info:http://www.g1.com/
Score: (3.00 in 6 votes)
**********************************************************************
*  
*  99 Bottles of Beer on the wall
*
*  Uses Group 1 Software PCE (Post Composition Engine) Language
*  www.g1.com
*
*  By: Donavan Hoepcke www.computerdudes.nu
*
**********************************************************************
declare <done>;
declare <num-bottles>;
declare <num-bottle-str>;
declare <zero>;
declare <one>;

  // Procedures
declare procedure <main> is main;
**********************************************************************
begin procedure <main>;

  let <zero> = 0;
  let <one> = 1;
  let <done> = false;
  let <num-bottles> = 99;

  let <num-bottle-str> = string <num-bottles> 0 zero;

  begin loop;

    trace "@@<num-bottle-str> bottles of beer on the wall";
    trace "@@<num-bottle-str> bottles of beer";
    trace "Take one down, pass it around";

    let <num-bottles> = <num-bottles> - <one>;
    let <num-bottle-str> = string <num-bottles> 0 zero;

    let <done> = <num-bottles> eq <one>;
      exit loop when <done>;

    trace "@@<num-bottle-str> bottles of beer on the wall";
   
  end loop;

  trace "@@<num-bottle-str> bottle of beer on the wall";
  trace "@@<num-bottle-str> bottle of beer";
  trace "Take one down, pass it around";
  trace "Time to buy some more beer for the wall";

end procedure; // <main>

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: