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

I don't get what this is asking me to do

Assign the value of the key name to the return value of the method get_name() in the contact hash. Assume that get_name() returns a string.

contact.rb
contact_list = []

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

2 Answers

In most of these, the answer is within the question. Don't overthink it. :)

contact_list = []

contact = {"name" => get_name(), "phone_number" => "" }

i'm dumb. haha. thank you!

Firstly, you're not dumb. We all make silly mistakes like this and that's why most companies employ teams of developers instead of just one. It's easy to overlook things like these and sometimes it takes a fresh perspective.

Secondly, you're quite welcome. You could repay Me by selecting My answer as "Best Answer". I'm trying to get My forum points to complete the course.

Happy coding, jordanresendiz!

The question is somewhat misleading because of this unknown "get_name" method. Are you suppose to be defining a method or are you merely assigning a value to a variable? It turns out to be the later, and the question might be made clearer if they asked,

"Make a variable 'get_name'. Set the value of get_name to the value of "name" key in the contact hash."