5.Attr_reader & Attr_writer, stuck!

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/ruby-beginner-en-zfe3o/0/5?curriculum_id=5059f8619189a5000201fbcb#

<In what way does your code behave incorrectly? Include ALL error messages.>
uninitialized constant Context::Person::Richard

```

Replace this line with your code.
class Person
attr_reader :name
attr_writer :job
def initialize(name, job)
@name = name
@job = job
end
bob = Person.new(‘Richard’,‘writer’)
puts Richard.name

def name
@name
end

def job=(new_job)
@job = new_job
end
end

<do not remove the three backticks above>
Agh! Just gotta finish a few more lessons, but this one is bogging me down. Anyway, this code SHOULD be right, but it won't work for some reason...

@quantumtechnologys

Your code looks a little bit off. This line:

shouldn’t be present inside your class (you can’t create new instance of the class inside the class!)
Next, you should remove this code:

From the instructions if you’ve clearly read them, it says you should replace this code by

attr_reader :name 
attr_writer :name

Hope this helped! :wink:

1 Like

It lets me pass now but it gives me this,

(ruby):7: warning: already initialized constant Richard

(Thanks!)

EDIT: Fixed it! Thanks for the help!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.