ruby中愚蠢的哈希更新实验

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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"}

以上是关于ruby中愚蠢的哈希更新实验的主要内容,如果未能解决你的问题,请参考以下文章