Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

add key and value to the beginning of a hash ruby

hash1 = { two: 2, three: 3 }

#add a new key,value 
hash1 = Hash[:one,1].merge!(hash1) #=> {:one=>1, :two=>2, :three=>3}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #key #beginning #hash #ruby
ADD COMMENT
Topic
Name
1+2 =