Bug? DataStructures/Hashes/Accessing Hash Values


#1



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"]


#2

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


#3

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