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 Usertalk

Date:04/20/05
Author:Anonymous
URL:n/a
Comments:0
Info:n/a
Score: (2.95 in 19 votes)
on ninetyNineBottles() {
  local {
    lyrics = "";
    bottleStartCount = 99;
    bottleString = "";
    eol = "\r"};

  on numBottles(theCount) {
    local {
      s = ""};
    case theCount {
      0 {
        s = "No more bottles"};
      1 {
        s = "1 more bottle"}}
    else {
      s = theCount + " bottles"};
    return(s)};

  on finishVerse(theCount) {
    local {
      s = "Take one down and pass it around, " + eol};
    s = s + numBottles(theCount - 1) + " of beer on the wall."\
    + eol + eol;
    return(s)};

  for bottleCount = bottleStartCount downto 1 {
    bottleString = numBottles(bottleCount);
    lyrics = lyrics + bottleString + " of beer on the wall, "\
    + bottleString + " of beer." + eol + finishVerse(bottleCount)};
  lyrics = lyrics + "No more bottles of beer on the wall, "\
  + "no more bottles of beer." + eol\
  + "Go to the store and buy some more." + eol\
  + "99 bottles of beer on the wall.";
  return(lyrics)};

theLyrics = @workspace.lyrics99;

if not defined (theLyrics^) {
  new (wptextType, theLyrics)};

target.set (theLyrics);

wp.setText(ninetyNineBottles());

edit (theLyrics); Ťopen it in a window

window.zoom("workspace.lyrics99")

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: