Use Hash.new to create a new hash called pets


#1

pets_Hash = {
"pets" => "cats"
}
puts pets_Hash["pets"]

where is problem?


#2

Can we start with what the problem is before we move on to where?


#3

thx man,english is not my first language,Thank you for correction


#4

I meant that you haven't described what the problem is, so others won't know what problem you are talking about. Why do you say that there is a problem? What are you trying to change?


#5

when i clike on save & submit code it say Oops, try again. Did you declare a variable called pets?


#6

Seems pretty straight-forward doesn't it?

pets = 5


#7

pets_Hash = {
"pets" => 5
}
puts pets_Hash["pets"]

Still not working :((


#8

Why should it though? You still haven't created a variable named pets.
In my previous example I created a variable by that name and assigned it to the value 5


#9

so sorry .can u learn me that how can i make a variable?!if u have a free time :expressionless:


#10

Type the name, then the assignment operator, then the value

pets = 5


#11

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