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

Loi Tran
Loi Tran
9,053 Points

What are you guys asking me to do? Assign to nil value as a return of a method which I write called 'get_name'?

contact_list = []


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

I'm not sure. I tried it several different ways.

Please rephrase your question - it's not clear what you're asking

Loi Tran
Loi Tran
9,053 Points

It's all good Andrew. I just played around with it for a little and got it figured out. I wasn't sure how they wanted me to do it from THEIR question. Haha