/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# From: http://www.ruby-forum.com/topic/111524 # Author: Daniel Martin a = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc) } a[2][1]=2 a[2][2][3]=4 a[3][1][1][1]=1 p a #=> {2=>{1=>2, 2=>{3=>4}}, 3=>{1=>{1=>{1=>1}}}}
URL: http://www.ruby-forum.com/topic/111524