Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Ruby Deep Dive Hashes Error

Hey everyone,

I'm getting this error when setting up the "treehouse" hash in the first video of the hashes badge for Ruby. Could anyone please lend a hand? Thanks!


1.9.3p392 :039 > treehouse["business_name"] => "Treehouse" SyntaxError: (irb):39: syntax error, unexpected tASSOC, expecting $end treehouse["business_name"] => "Treehouse" ^ from /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `<main>'

4 Answers

Hey Scott,

You might be missing an 'end' statement at the end of your code.

It always helps to post your code as well as the error.

I did post my code in that block. -

1.9.3p392 :039 > treehouse["business_name"] => "Treehouse"

It included the syntax error right after it -

SyntaxError: (irb):39: syntax error, unexpected tASSOC, expecting $end treehouse["business_name"] => "Treehouse" ^ from /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `'

No end should be necessary at the end of that line as far as I can tell from the video.

You can't assign a key / value pair that way, you may either use

 treehouse = {}
 treehouse["business_name"] = "Treehouse"


 treehouse = {"business_name" => "Treehouse" }

HTH :)

I will try this...the way I was doing it worked on every key/value pair except for business_name. I should note that "treehouse" already existed with other pairs inside of it when I was trying to add it.

Thanks for the help!