real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language D

Author:Stewart Gordon
Score: (3.84 in 186 votes)
import std.stdio;
import std.string;

void main() {
    int bottles = 99;
    char[] text = "99 bottles";

    while (bottles != 0) {
        writefln(text, " of beer on the wall,");
        writefln(text, " of beer.");
        writefln("Take one down, pass it around,");

        if (--bottles == 1) {
            text = "1 bottle";
        } else {
            text = format("%d bottles", bottles);
        writefln(text, " of beer on the wall.\n");

Download Source | Write Comment

Alternative Versions

Template metaprogrammingDon Clugston07/11/061
D feuture's galoreFredrik Olsson10/09/052
Fiber "Ring"Bryan Knowles11/17/100
Div Operator Editionbadmadevil02/29/080
5Philipp Winterberg04/20/057


>>  gneek said on 10/05/08 00:45:57

gneek This looks really nice!

>>  Sylver said on 01/30/09 07:09:35

Sylver Nice, but you are missing the last line:
"No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall."

>>  Demian said on 04/28/10 22:29:06

Demian Wow, I love this one, very creative.

>>  Chi Hair Straighteners said on 09/25/10 02:47:47

Chi Hair Straighteners Cheap Chi Flat Irons, Chi Hair Straighteners sale at Farouk outlet, 100% Authentic & Brand New, All over world free shipping.
Chi Hair Straighteners
Chi Hair Straightener
Chi Flat Irons
Chi Flat Iron
cheap gucci shoes

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!




Security Code: