I'm probably trying to be hard headed about this. I'm trying to format hash key and and array of values for output to user. Ruby-doc give me the code for it for one value. http://www.ruby-doc.org/core/classes/Hash.html#M002861
h = { "a" => 100, "b" => 200 }
h.each {|key, value| puts "#{key} is #{value}" }
I'm trying to get
h = { "a" => [100,'green'], "b" => [200,'red'] }
h.each {|key, m,n| puts "#{key} is #{m} and #{n}"}
produces:
a is 100 and green
b is 200 and red
I've had some luck with h.each{|key,m,n| puts "#{key} is #{[m,'n']} "}
it produces:
a is 100green
b is 200red
I need some space between my array of elements, how do I go about doing that?