I've created a Person class and my code is correct, but I just wanted someone to clarify a specific line.
class Person
attr_reader :first_name, :last_name, :age
def initialize (first_name, last_name, age)
@first_name = first_name
@last_name = last_name
@age = age
end
end
The line I'm confused about is the attr_reader
one. Why does this need to be included and why do I need the :
before each attribute?