On Wed, Aug 27, 2008 at 9:57 AM, Todd Benson <caduceass / gmail.com> wrote: > On Tue, Aug 26, 2008 at 6:30 PM, danielj <sleepingindian / gmail.com> wrote: >> Also, would there be an easy way to print the words out instead of the >> numbers of bottles on the wall? > > Divide the number by 10 and it will give the prefix (ninety-, eighty-, > etc.) You need a list or hash of some sort, of course. Simple > example... > > prefixes = {9 => "ninety-", 8 => "eighty-"} > > ...or even better... > > prefixes = ["", "", "twenty-", "thirty-", "forty-"] > > ...and so on. And then modify the numbers ten through nineteen after > the transformation (you don't want "one" for "eleven" do you) since > they differ in nomenclature from the others. > > You could automagically use suffixes instead of prefixes if the > number, when divided by 10 is 1, but that wouldn't help you with the > edge cases of 'ten', 'eleven', and 'twelve'. http://p.ramaze.net/1900 my stab at it ^ manveru