Ruby Ruby Objects and Classes Build a Bank Account Class Adding Transactions

Sarah Dawson
Sarah Dawson
2,342 Points

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