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 MCPL

Date:04/27/06
Author:Christian Meurin
URL:n/a
Comments:0
Info:http://www.cl.cam.ac.uk/users/mr/MCPL.html
Score: (3.00 in 2 votes)
// MCPL is a combination of BCPL, C, ML, and Prolog.
//
// http://www.cl.cam.ac.uk/users/mr/MCPL.html

MODULE bottlesofbeer

GET "mcpl.h"

MANIFEST beermax = 99
MANIFEST onebeerleft = 1
MANIFEST nobeer = 0

FUN start : =>
  LET count = beermax

  UNTIL count == nobeer DO {
    IF count == onebeerleft DO {
      writef ("%d bottles of beer on the wall,\n", count)
      writef ("%d bottles of beer...\n", count)
    } ELSE {
      writef "One more bottle of beer on the wall,\n"
      writef "One more bottle of beer...\n"
    }

    writef "Take one down, pass it around,\n"

    IF count == onebeerleft DO
      writef "One more bottle of beer on the wall.\n"
    ELSE IF count > onebeerleft DO
      writef ("%d more bottles of beer on the wall.\n", count)
    ELSE writef "No more bottles of beer on the wall.\n"
.

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: