Posted By

inkdeep on 03/10/10


Tagged

ruby hash


Versions (?)

stupid hash update experiments in ruby


 / Published in: Ruby
 

  1. h1 = {'1'=>'a', '2'=>'b', '3'=>'c', '4'=>'z'}
  2. h2 = {'4'=>'e'}
  3. puts h1.inspect
  4. # => {"1"=>"a", "2"=>"b", "3"=>"c", "4"=>"z"}
  5. h1.update(h2)
  6. puts h1.inspect
  7. # => {"1"=>"a", "2"=>"b", "3"=>"c", "4"=>"e"}

Report this snippet  

You need to login to post a comment.