From: Harry Kakueki Date: 2007-06-17T08:14:43+09:00 Subject: Re: Adding new value (in array) to existing key in a hash On 6/16/07, Gilbert Lau wrote: > > Correct me if I am wrong... the = [] means that i initiate the value for > the hash as array first before I input the values as array [i,j] into > the hash. Is that the explanation for the code above? > Yes, it sets up the value as an array and pushes arrays into that array. This does the same. myhash = Hash.new myhash["Starbuck"] = Array.new myhash["Starbuck"].push([1,2]) myhash["Starbuck"].push([1,7]) p myhash p myhash["Starbuck"][1] p myhash["Starbuck"][1][1] Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/