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 Chrome

Date:04/19/06
Author:Christian Meurin
URL:n/a
Comments:1
Info:http://www.chromesville.com/index.asp
Score: (2.00 in 4 votes)
(* Chrome is an Object Pascal variant that runs on the .NET
   platform. It is inspired by Delphi.NET and adds several
   new language features.

   Although a Chrome application normally includes an
   AssemblyInfo.pas file, I felt it was insignificant for
   a 99 Bottles of Beer example.

   This example utilizes Chrome v1.5, which can be found at:
   http://www.chromesville.com/index.asp
*)

namespace BottlesOfBeer;

interface

uses
  System; // from the .NET framework that is...

type
  LetsStartChugging = public class
  {$REGION Declarations} // Not necessary, just for show off
  public
    constructor;
    class method Main(Args: array of String);
  end;
  {$ENDREGION}

implementation

constructor LetsStartChugging;
begin
  // Does nothing, but just shows how Chrome constructors are used.
end;

[STAThread] // Apparently needed for .NET application Main method
class method LetsStartChugging.Main(Args: array of String);
var
  GotAlcoholPoisoning: Boolean;
  BeerStock: Integer;
begin
  for BeerStock := 99 downto 0 do begin
    if BeerStock > 1 then begin
      Console.WriteLine(BeerStock + ' bottles of beer on the wall,');
      Console.WriteLine(BeerStock + ' bottles of beer.');
    end
    else begin
      Console.WriteLine('One more bottle of beer on the wall,');
      Console.WriteLine('One more bottle of beer.');
    end

    Console.WriteLine('Take one down, pass it around,');

    if BeerStock = 1 then begin
      Console.WriteLine('One more bottle of beer on the wall.');
    else begin
      Console.WriteLine(BeerStock + ' more bottles of beer on the wall.');
    end
  end

  Console.WriteLine('<passes out from drinking too much>');
end

end.

Download Source | Write Comment

Alternative Versions

Comments

>>  Chris said on 04/19/06 16:14:10

Chris Whoops, I have an unused boolean variable in there. :-\

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: