Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby Ruby Collections Ruby Hashes Ruby Hash Creation

Whats Wrong

Can figure this out, im a dumb ****

hash.rb
grocery_item_1 = Hash.new
grocery_item_1 = {name => milk}

1 Answer

andren
andren
28,550 Points

Your code is actually fine, the issue is of all things the quote marks you use. I don't know how you wrote the code but the quote marks you use are not standard ones, but stylized quote marks which are more commonly found within word documents and the like. Stylized quote looks similar to regular quotes but they are in reality entirely different symbols, and as such do not work to create strings in programming languages.

If you replace them with standard quote marks like this:

grocery_item_1 = Hash.new
grocery_item_1 = {"name" => "milk"}

Then your code will work.

Also as a side note I'd recommend editing your post, as swearing is frowned upon in this forum.

I didnt think my code was wrong, Thanks!