Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Task 1 is not working!
Not sure where I'm going wrong
class Name name = "" def initialize(title) @title = title end def first_name "Metal" end def last_name "Robot" end def title @title =  end end name = Name.new("Middle Name") name = Name.title
Juan Gonzalez12,960 Points
Hi Victor, I guess you get stucked somewhere between 3th and 4th, first of all the 3th task say "Inside the Name class, create a method called title that returns the @title variable."
and you are writting
def title @title =  end
in this part, you are overriding the actual title value you assign in the initialized method with an empty array, it should be just
def title @title end
and in the last task it say "Call the title method on the name instance." and you are writting
name = Name.title
as you are assigning a title method of the Name class (which does not actually exists) so you are getting an error, you need to call the title method of your current Name instance, that you previously assigned to the name variable, so it should look like this
the final code should look something like this
class Name def initialize(title) @title = title end def first_name "Metal" end def last_name "Robot" end def title @title end end name = Name.new('hello') name.title
hope this can help you, happy coding!