From: Erik Terpstra Date: 2005-11-26T00:52:27+09:00 Subject: Re: recursion ('aaa'..'zzz').to_a Cheers, Erik. cyberco wrote: > I'm trying to print every combination of three characters from the > range (a..z). I thought recursion would be the most elegant solution, > but that got me quite confused :) Any suggestions? Here's my > (erronous) attempt: > > ________________________ > > def addChar(str, level) > ('a'..'z').each {|c| > if level == 2 > puts str + c > else > str += c > addChar(str, level + 1) > end > } > end > > addChar("", 0) >