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 Loops Build a Simple Contact List Assigning Hash Values From Methods

Wont tell me why its not working?

I'm I missing something as it looks good to me

contact.rb
contact_list = []

contact = {"name" => "", "phone_number" => "" }

contact["name"].push(get_name)

3 Answers

At the moment, the name attribute has an empty string assigned to it. 'name' => "".

Instead of that, the challenge wants you to use the get_name method so that the 'name' attribute holds what that method returns.

So, instead of 'name' => "" change this to 'name' => get_name. This means that 'name' willl now hold whatever is returned by the method, get_name.

Make sense?

Steve.

I did that only I had "get_name", thank you for clarifying it!

Ah, yes. The method name doesn't require the "" surrounding it. Just call it directly as-is.

Hi Victor,

I just posted in your other thread about this challenge.

You want to replace the assignment of the empty string, "", with the call to the get_name method. So, delete the "" and replace with get_name.

Steve.

still not following mate

Still not following mate...