99 bottles of beer: Difference between revisions

Line 2,522:
= self literal + (self != 1) iif(" bottles"," bottle").
bottleEnumerator = Variable new:self; doWith(:targetn)
[
^ Enumerator::
{
bool next = targetn > 0.
get = StringWriter new;
printLine(targetn bottleDescription," of beer on the wall");
printLine(targetn bottleDescription," of beer");
printLine("Take one down, pass it around");
printLine((targetn reduce:1) bottleDescription," of beer on the wall").
reset []
Anonymous user