From: 7stud -- Date: 2009-07-22T14:42:13+09:00 Subject: Re: why I get an empty hash? Look at what happens when the array has one element: data = ["A"] result = table(data, 2) (1) table(array=["A"], word_size=2, word='') --------------------- hash_table = {} e = "A" if false else (2)table(array=["A"], word_size=1, word='') #Execution halts in the first table call until #the return value of this recursive table() call can #be determined... (2) table(table(array=["A"], word_size=1, word='') -------------------- hash_table = {} e = "A" if true hash_table["A"] = 0 return {"A" => 0} #Now the return value for the recursive table() call has been #determined, so the return value can be substituted in (1) and #execution can continue... (1) ------------ =begin hash_table = {} e = "A" if false =end else {"A" => 0} #from (2) return hash_table -- Posted via http://www.ruby-forum.com/.