Sean Flanagan33,225 Points
Ruby Objects and Classes -> Variables
Hi. This code won't work. I don't know why.
class Name def initialize(title, forename, middle_name, surname) @title = title @forename = forename @middle_name = middle_name @surname = surname end def title @title end def forename @forename end def middle_name @middle_name end def surname @surname end end name = Name.new("Mr.") puts name.title + name.forename + name.middle_name + name.surname
name.rb:3:in `initialize': wrong number of arguments (1 for 4) (ArgumentError) from name.rb:27:in `new' from name.rb:27:in `<main>'
I'd be grateful please to know how to correct this. :-)
"name = Name.new("Mr.")" You need to pass all 4 arguments when calling new.