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

Hello, I didn not understand the meaning "return" here. Could you please help me?

I simply have no solution for this task. Help please

contact.rb
contact_list = []

def get_name
  contact = {"name" => "", "phone_number" => "" }
    return contact["name"]
end

get_name()

1 Answer

Steven Parker
Steven Parker
231,269 Points

The instructions tell you that the get_name method is defined "Elsewhere in the program", so you don't need to define it here.

All you need to do for task 1 is to call that method to assign the value of the "name" key.

Hint: it won't require any new lines of code, your changes will replace the first empty string.