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 Mops

Date:04/20/05
Author:Anonymous
URL:n/a
Comments:1
Info:http://www.netaxs.com/~jayfar/mops.html
Score: (2.60 in 10 votes)
\ Mops Beer (object paradigm)
\ by Bruce Bennett

:class BEER super{ object }

record{
          var   n
}

private

:m lastBottle:
        cr ." 1 last bottle of beer on the wall," cr
        ." Only 1 bottle of beer." cr
        ." Take it down, pass it around --" cr
        ." No more bottles of beer!" cr
;m

public

:m bottlesOf: { n -- }
        1 n DO
            i 1 = IF lastBottle: self LEAVE THEN cr
            i . ." bottles of beer on the wall," cr
            i . ." bottles of beer." cr
            ." Take one down, pass it around," cr
            i 2 = IF i 1 - . ." last bottle of beer." ELSE
            i 1 -  . ." bottles of beer on the wall." THEN cr
        -1 +LOOP
;m

;class

beer    beer!

99 bottlesOf: beer!

Download Source | Write Comment

Alternative Versions

Comments

>>  Ivo Krab said on 04/05/07 16:58:14

Ivo Krab URL in description is outdated, go to http://www.powermops.org instead.

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: