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 AsmL/NET

Date:04/20/05
Author:Chris R. Timmons
URL:n/a
Comments:0
Info:n/a
Score: (2.97 in 100 votes)
/*
 * NinetyNine.asml
 *
 * The "99 Bottles of Beer" song rendered in AsmL.NET 
 * (Abstract State Machine Language for MS.NET).
 *
 * To get AsmL.NET, go to Microsoft Research at:
 *
 *   http://research.microsoft.com/foundations/AsmL/
 *
 * Written by Chris R. Timmons (chris "at" crtimmonsinc "dot" com)
 * September 8, 2003
 * http://www.crtimmonsinc.com/
 */

const MaxBottles = 99
var Bottles = MaxBottles

function GetCorrectBottlesTense(bottles as Integer) as String
  if bottles > 1 then
    return bottles + " bottles"
  elseif bottles = 1 then
    return bottles + " bottle"
  else
    return "No more bottles"

Main()
  step while Bottles > 0
    WriteLine(
      GetCorrectBottlesTense(Bottles) + " of beer on the wall,\n" +
      GetCorrectBottlesTense(Bottles) + " of beer.\n" +
      "Take one down, pass it around.\n" +
      GetCorrectBottlesTense(Bottles - 1) + " of beer on the wall.\n")
    Bottles := Bottles - 1
  step
    WriteLine(
      "No more bottles of beer on the wall,\n" +
      "No more bottles of beer.\n" +
      "Go to the store, get some more!\n" +
      MaxBottles + " 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: