From: Li Chen Date: 2009-07-22T17:24:02+09:00 Subject: Re: why I get an empty hash? 7stud -- wrote: > Look at what happens when the array has one element: > > data = ["A"] > result = table(data, 2) If what you explain is right, how come I get 'AA' when I add a line here: def table(array,word_size=1,word='') hash_table=Hash.new(0) array.each do |e| if word_size==1 puts "#{word+e}"############# add a line to see if 'AA' is created hash_table["#{word+e}" ]=0 else table(array,word_size-1,word+e ) end end return hash_table end -- Posted via http://www.ruby-forum.com/.