Bug? DataStructures/Hashes/Accessing Hash Values


You are not

I kept on receiving this error that said I am not printing all the hash values. The reason was that my value was a number. It worked when I changed it to a string.

# didn't work: 
pets = Hash.new

pets["Boom"] = 1

puts pets["Boom"]  

# worked: 
pets = Hash.new

pets["Boom"] = "string"

puts pets["Boom"]


It's not really a bug since the code works. The SCT may be expecting a string, so that is what we must supply.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.