Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

difference between Hash.new and Hash.new { |h, k| h[k] = [] }

h = Hash.new { |h, k| h[k] = [] }
h[:a]        # => {:a=>[]}
h[:b] << 123 # => {:a=>[], :b=>[123]}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #difference
ADD COMMENT
Topic
Name
8+4 =