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 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 :