+ 1

Why is this code resulting to NO OUTPUT?

h = {a:2, b:4, c:8} sum = 0 h.each do |k,v| sum += v end

21st Nov 2019, 4:37 PM
Allan 🔥STORMER🔥🔥🔥🔥
Allan 🔥STORMER🔥🔥🔥🔥 - avatar
4 Respostas
+ 8
Allan Decker code is correct you just need to print the sum. h = {a:2, b:4, c:8} sum = 0 h.each do |k,v| sum += v puts sum end
21st Nov 2019, 4:40 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 7
Allan Decker no problem 😊
21st Nov 2019, 4:48 PM
GAWEN STEASY
GAWEN STEASY - avatar
0
Thank you Gwen it's working
21st Nov 2019, 4:44 PM
Allan 🔥STORMER🔥🔥🔥🔥
Allan 🔥STORMER🔥🔥🔥🔥 - avatar
0
[EXPUNGED] answer. Albert Stuff please don't spam in q/a section continuous action can result in your account deactivation so use this section for asking programming doubts.
21st Nov 2019, 5:30 PM
Albert
Albert - avatar