You should instantiate your hash h first, and then fill it with the contents of the array: h = {} ary = ["a", "b", "c"] ary.each{|a| h[a] = 0}.
確定! 回上一頁