12. The Hash Rocket Has Landed

ruby

#1

I am changing my Hash code from using the rockets symbol to the new Ruby 1.9 format, but I keep receiving any error. Could someone please explain what I am doing wrong?

My code:
movies = { "The Devil Wears Prada":"4.5 stars",
"Mean Girls":"4 stars"
}

The error:
(ruby): syntax error, unexpected ',', expecting $end


#2

Hello spranita3,
you don't have to put "", no spaces in a symbol and no capital neither
the good syntax is:
movies = {
the_devil_wears-prada: "4.5 stars",
mean_girls: "4 stars"
}


#3

Hi coderunner43295,
Thank you for your help! It worked once I removed the quotes and spaces.


#4

my code
movies = Hash.new
movies = {
:movie1 => "inicivity",
:drácula => " beteenn",
:matrix => "four"
}
puts new_hash
it´s not necessary the puts but the answeris you don´t use the new hash sintax..


#5

movies = {
friday: "funny asl",
talks: "Vic Damone",
wick: "cold asl"
}

the key has to be one word not multiple--- this code worked for me