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 trialMiles Smith
2,688 PointsCorrect the code below to make the contacts variable an instance variable.
Hey guys i get the error saying the "@" symbol turns my code into an instance variable, but isn't that whats being asked of me to find?
class AddressBook
attr_reader :contacts
def initialize
@contacts
end
end
1 Answer
Cena Mayo
55,236 PointsHi Miles,
I think you may have just inadvertently deleted the variable assignment:
class AddressBook
attr_reader :contacts
def initialize
@contacts =[]
end
end
Best, Cena