title: Array#each vs. Array#map
body: <pre><code>hash = { "d" =&gt; [11, 22], "f" =&gt; [33, 44, 55] }
  
  # case 1
  hash.map {|k,vs| vs.map {|v| "#{k}:#{v}"}}.join(",")
  =&gt; "d:11,d:22,f:33,f:44,f:55"
  
  # case 2
  hash.map {|k,vs| vs.each {|v| "#{k}:#{v}"}}.join(",")
  =&gt; "11,22,33,44,55"
  </code></pre>
  
  <p>only difference is case 1 uses <code>vs.map</code>, case 2 uses <code>vs.each</code>.</p>
  
  <p>What happened here?</p>