I am having trouble with the syntax for reduce. I have a hash of the following format:
H = {\"Key1\" => 1, \"Key2\" => 2}
I would like t
You can make elem contain the value by splitting it up in 2 variables:
elem
H.reduce(0) {|memo, (key, val)| memo += val}