Ruby Ruby Objects and Classes Variables and Methods Attribute Writers and Accessors

dharshi thiru
dharshi thiru
3,203 Points

It gives error task 1 no longer parsing. When i go back and check Task 1 it parses fine.

class Name attr_reader :title attr_writer :first_name attr_accessor : :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.rb
class Name
  attr_reader :title
  attr_writer :first_name
  attr_accessor : :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

2 Answers

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there! The error message actually says that it's "no longer passing", not parsing. And this is an indication of a syntax error. In your case, in step 2 you've got a typo on this line:

  attr_accessor : :last_name

It should be:

  attr_accessor :last_name

Note that your original version has an extra colon in it. I feel like this was just a typo. Good luck and happy coding! :sparkles: