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 Emerald

Date:04/20/05
Author:David Eddyshaw
URL:n/a
Comments:0
Info:n/a
Score: (2.50 in 10 votes)
% 99 Bottles of Beer in Emerald
% by David Eddyshaw <david@jeddyshaw.freeserve.co.uk>

const beer <- object beer
  initially
    for i : Integer <- 99 while i > 0 by i <- i - 1
       self.bottles[i]
       stdout.putstring[" of beer on the wall,\n"]
       self.bottles[i]
       stdout.putstring[" of beer.\n"]
       stdout.putstring["Take one down and pass it around;\n"]
       self.bottles[i-1]
       stdout.putstring[" of beer on the wall.\n\n"]
    end for
  end initially
  operation bottles [x : Integer]
    if x = 0 then
       stdout.putstring["No more bottles"]
    elseif x = 1 then
       stdout.putstring["1 bottle"]
    else
       stdout.putint[x,0]
       stdout.putstring[" bottles"]
    end if
  end bottles
end beer

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: