Skip to Content
Learn
Hashes and Symbols
All Aboard the Hash Rocket!

The hash syntax you’ve seen so far (with the => symbol between keys and values) is sometimes nicknamed the hash rocket style.

numbers = { :one => 1, :two => "two", :three => 3, }

This is because the => looks like a tiny rocket!

Let’s build a hash from the ground up using symbols as keys.

Instructions

1.

Create a hash called movies with symbols as keys and strings as values.

Inside your hash, add two key/value pairs.

The keys should be the names of movies.

The values should be quick descriptions or reviews.

Check out the Hint if you want an example to get you started!

Folder Icon

Take this course for free

Already have an account?