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 Ruby Objects and Classes Build a Bank Account Class Adding Transactions

Why doesn't "@transactions.push(description => description, amount => amount)" work for this exercise?

Since you can create a hash with "=>" and ":", I assumed I could substitute the former, even though the latter was used in the video. Can you explain why I can't do that here? I checked the documentation, and I didn't see anything that would prohibit the usage. Thanks!

Zachery Irvin
Zachery Irvin
13,958 Points

The question specifically states that the key needs to be a symbol. The way you have answered the question is using a string as the key. The keys need to be symbol syntax with a :

1 Answer

Zachery Irvin
Zachery Irvin
13,958 Points

The question specifically states that the key needs to be a symbol. The way you have answered the question is using a string as the key. The keys need to be symbol syntax with a :