0
[SOLVED] I seriously need help on this
The question is: h = {a:8, b:9, c:18} sum = 0 h.each {|key, val| sum+= } puts sum WHAT IS IT PLEASE
3 ответов
+ 5
What is this code snippet doing?
Its utilizing each method for adding all the values from the key-value pairs of a dictionary h.
each method in ruby:
https://www.thoughtco.com/using-each-beginning-ruby-control-structures-2641202
https://code.sololearn.com/c908U4Fm6d91/?ref=app
+ 6
# DigitalIsaax you're welcome :) , here's a simple way to achieve the same thing.
h = {a:8, b:9, c:18}
puts h.values.sum
+ 4
Hey thanks for helping
I was really stuck