Language T3X
| Date: | 04/20/05 |
| Author: | Nils M. Holm |
| URL: | n/a |
| Comments: | 0 |
| Info: | n/a |
| Score: |
module bottles(t3x, string);
! 99 bottles of beer on the wall
! 2002-05-03 Nils M Holm <nmh@t3x.org>
#packstrings;
object t[t3x], str[string];
writes(s) t.write(T3X.SYSOUT, s, str.length(s));
writef(s, v) do var tmp::40;
writes(str.format(tmp, s, v));
writes(t.newline(tmp));
end
bottles(n, w, c) do var tmp::3;
writef("%s bottle%s of beer%s%c",
[(n-> str.format(tmp, "%d", [(n)]):
c='.'-> "no more": "No more"),
(n=1-> "": "s"),
(w-> " on the wall": ""),
(c)]);
end
do var i;
for (i=99, 0, -1) do
bottles(i, 1, ',');
bottles(i, 0, '.');
writef("Take one down and pass it around,", 0);
bottles(i-1, 1, '.');
writef("", 0);
end
bottles(0, 1, ',');
bottles(0, 0, '.');
writef("Go to the store, buy some more,", 0);
writef("99 bottles of beer on the wall.", 0);
end
Download Source | Write Comment
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