Hash rocket has landed


#1

using the following 1.9 syntax to replace the hash rocket style. don't understand what is possibly wrong

movies{
batman:brucewayne
momento:leonardo
}


#2

You have to create a new hash for your variable "movies"

I passed with the following code

movies = Hash.new
movies = {
:Goodfellas => "Classic you need to see it fast",
:SoulPlane => "Bad you should not see it",
:Friday => "Classic you must see it"
}

When using text for your values use quotation marks. When you use numbers you don't need quotations on your values.

I hope you can learn from it.


#3

Whoopseeee!

Just finally landed on Hash rocket has landed after checking my section...and PASSED...the code is still the same just change the => to : and that's it! It should appear like this now:

movies = Hash.new
movies = {
Goodfellas: "Classic you need to see it fast",
SoulPlane: "Bad you should not see it",
Friday: "Classic you must see it"
}


#4

You don't need to use a new hash if it's to replace it afterwards by a filled one.


#5

I passed with this!

movies = {
batman: 'Great!',
superman: 'I watched twice',
}


#6

movies = {
starwars : 'why',
intern : 'isnt',
ipman : 'it working',
}

why isnt this working?

(ruby):1: syntax error, unexpected ':', expecting tASSOC
starwars : 'why',
^
(ruby):1: syntax error, unexpected ',', expecting $end


#7

Two reasons this isn't working.

First, the colon is part of the symbol, so it needs to be immediately after the word you're using as a symbol, but you have a space between the symbol and the colon.

You have:
starwars : 'why',

and it should be
starwars: 'why',

Second, you have a comma after the last key/value pair in your hash. You use commas here kind of like you're writing a list.

I like chocolate , potato chips , and gummy bears.

See? No comma after the last thing in my list (gummy bears). Same thing with hashes. No comma after the last key/value pair.