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 Build an Address Book in Ruby Input and Output Adding Contacts: Part 2

Loi Tran
Loi Tran
9,053 Points

adding phone number or address yields multiple contact adds

if you choose to add multiple phone numbers in this program it bugs out and adds multiple contacts instead. just saying =)

Seems to be working as intended for me!

You might have inserted the line

 contacts.push(contact)

in the wrong place.

Inserting the line before it should be, such as below

                    print "\n"
                    break
            end
            contacts.push(contact)
        end
    end

will result in duplicate entries.

In the correct place

                    print "\n"
                    break
            end
        end
        contacts.push(contact)
    end

it should work as intended.