Language Mops
| Date: | 04/20/05 |
| Author: | Anonymous |
| URL: | n/a |
| Comments: | 1 |
| Info: | http://www.netaxs.com/~jayfar/mops.html |
| Score: |
\ 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
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!
Comments