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 trialSydney Cohen
2,909 PointsNot sure what to do here: Instantiate an instance of the Name class and assign it to the variable name. This must come a
thanks for helping
class Name
def first_name
"First"
end
def last_name
"Last"
end
end
def name(name)
@name = name
end
3 Answers
Kevin Mulhern
20,374 PointsYou need to create a new instance of the Name class. like this:
name = Name.new("kevin")
Salman Akram
Courses Plus Student 40,065 PointsHi Sydney,
You need to put instance of variable "name" AFTER we have Name class, I know it is a bit trick. What we do is to add name instance in the end of the line below.
class Name
def first_name
"First"
end
def last_name
"Last"
end
end
name = Name.new
puts name
Good Example again at 2:43, you can idea of code samples under teacher's note.
Lorraine Hutter
4,415 PointsThis is what worked for me:
class Name
def first_name
"First"
end
def last_name
"Last"
end
end
# everything after this line is my attempt
name = Name.new
Sydney Cohen
2,909 PointsSydney Cohen
2,909 PointsThanks Kelvin.. i got confused with the wording !!