I think I’m on the right track, but when I try to call for p.first_name. I get an error which can be seen in the screenshot, does anyone know what I’m doing wrong?
screenshot http://snag.gy/pj6ny.jpg
Here is a link if you can’t see it: http://snag.gy/pj6ny.jpg
Here is the code:
class Person
def initialize (first_name, last_name, age)
@first_name = first_name
@last_name = last_name
@age = age
end
end
Everything is fine when I enter
> p = Person.new("Earl", "Rubens-Watts", 2)
but it goes weird after that. Desired output is:
> p = Person.new("Earl", "Rubens-Watts", 2)
> p.first_name
=> "Earl"
> p.last_name
=> "Rubens-Watts"
> p.age
=> 2
Thanks!
You haven’t defined a
first_namemethod or declared any attributes. Try this: