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 trialJonathan Walz
21,429 PointsGetting this error and don't understand why: name.rb:13:in `new': wrong number of arguments (4 for 0) (ArgumentError)
class Name
attr_reader :title, :first_name, :middle_name, :last_name,
def initialize(title, first_name, middle_name, last_name)
@title = title
@first_name = first_name
@middle_name = middle_name
@last_name = last_name
end
end
name = Name.new("Mr.", "Jon", "James", "Walz")
puts name.title + " " +
name.first_name + " " +
name.middle_name + " " +
name.last_name
2 Answers
Kevin Gravett
11,167 PointsHey, I think you just need to drop that trailing comma after :last_name
in your attr_reader
.
Kevin Gravett
11,167 PointsYou're welcome -- glad it helped!
Jonathan Walz
21,429 PointsJonathan Walz
21,429 PointsYes! Thank you!