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 trialMarguerite Holden
6,075 PointsDon't get what its asking for.
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_list = []
contact = {"name" => "", "phone_number" => "" }
contact = {"name" => "gets_name()"}
2 Answers
Alexander Davison
65,469 PointsYou weren't supposed to make a brand-new line of code, but to edit the second line of code.
Also, you are assigning the key name
to the actual string gets_name()
, not the return value of gets_name
.
You are very close, though.
Try this:
contact_list = []
contact = {"name" => gets_name(), "phone_number" => "" }
Good luck! ~alex
Maciej Czuchnowski
36,441 PointsOK, so you almost got it right. This:
contact = {"name" => "gets_name()"}
is wrong for two reasons: 1) you wrote the name of the method as a strong - just get rid of the quotes an leave "name" => "gets_name()"
. Second thing - you did this in a new line - do it in the line that the challenge already gave you.
Alexander Davison
65,469 PointsLol answered at about the same time
Marguerite Holden
6,075 PointsThx, very helpful!