Stuck on the hash! Can't get past it


#1



It won't let me move on to next lesson - error is saying:
"Oops, try again. It looks like you didn't print out the value of each of the keys stored in your hash."

Can't work out what I need to do.


pets = Hash.new
pets = {
    "chester" => "dog",
    "james" => "hamster",
    "julie" => "fish"
}

puts pets["chester"]
# will print "dog"


#2

Never mind, worked it out!

pets = Hash.new
pets = {
"chester" => "dog",
"james" => "hamster",
"julie" => "fish"
}

puts pets["chester"], pets["james"], pets["julie"]


#3

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