In Ruby, what's the advantage of #each_pair over #each when iterating through a hash? : <p>Let's say I want to access the values of a hash like this:</p>

<pre><code>munsters = {
  "Herman" =&gt; { "age" =&gt; 32, "gender" =&gt; "male" },
  "Lily" =&gt; { "age" =&gt; 30, "gender" =&gt; "female" },
  "Grandpa" =&gt; { "age" =&gt; 402, "gender" =&gt; "male" },
  "Eddie" =&gt; { "age" =&gt; 10, "gender" =&gt; "male" },
  "Marilyn" =&gt; { "age" =&gt; 23, "gender" =&gt; "female"}
}
</code></pre>

<p>I could use <code>#each</code> with two parameters:</p>

<pre><code>munsters.each do |key, value| 
    puts "#{name} is a #{values["age"]}-year-old #{values["gender"]}."
end
</code></pre>

<p>Or I could use <code>#each_pair</code> with two parameters:</p>

<pre><code>munsters.each_pair do |key, value| 
    puts "#{name} is a #{values["age"]}-year-old #{values["gender"]}."
end
</code></pre>

<p>Perhaps the difference between the two is not borne out in this simple example, but can someone help me to understand the advantage of using <code>#each_pair</code> over <code>#each</code> ?</p>
