Array#each与Array#map
hash = { "d" => [11, 22], "f" => [33, 44, 55] } # case 1 hash.map {|k,vs| vs.map {|v| "#{k}:#{v}"}}.join(",") => "d:11,d:22,f:33,f:44,f:55" # case 2 hash.map {|k,vs| vs.each {|v| "#{k}:#{v}"}}.join(",") => "11,22,33,44,55" 唯一的区别是案例1使用vs.map,案例2使用vs.each。 这里发生了什么?