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

Kevin Naegele
Kevin Naegele
10,868 Points

Workspaces not work with ruby?

I am going through Ruby and half of my code does not work inside of workspaces. I have copied and past the code from the lesson to run and still getting errors.

def add_contact
  contact = {"name" => "", "phone_numbers" => []}
  contact["name"] = ask("What is the person's name?")
  answer = ""
  while answer != "n"
    answer = ask("Do you want to add a phone number? (y/n)")
    if answer == "y"
      phone = ask("Enter a phone number:")
      contact["phone_numbers"].push(phone)
    end
  end
end

answer = ""
while answer != "n"
  contact_list.push(add_contact())
end
Brandon Barrette
Brandon Barrette
20,485 Points

Please post your errors so we can help you diagnose.

1 Answer

Kevin Naegele
Kevin Naegele
10,868 Points

I have tried to copy and past, but it is not working. I am looking at trying on my local machine. some is working but so of it might be my code.