Language D
| Date: | 05/31/05 |
| Author: | Stewart Gordon |
| URL: | http://www.stewartsplace.org.uk/ |
| Comments: | 0 |
| Info: | http://www.digitalmars.com/d/ |
| Score: |
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
| Version | Author | Date | Comments | Rate |
|---|---|---|---|---|
| Template metaprogramming | Don Clugston | 07/11/06 | 1 | |
| D feuture's galore | Fredrik Olsson | 10/09/05 | 1 | |
| 3 | Philipp Winterberg | 04/20/05 | 6 | |
| Div Operator Edition | badmadevil | 02/29/08 | 0 |
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