Quotes help make search much faster. Example: "Practice Makes Perfect"

Sunday, January 20, 2013

Codecademy Sample Solution: attr_reader, attr_writer



class Person
  attr_reader :name
  attr_reader :job
  attr_writer :job
  def initialize(name, job)
    @name = name
    @job = job
  end
end

client = Person.new("Jim", "programmer")
puts "#{client.name} is a #{client.job}"
client.job = "dentist"
puts "#{client.name} is a #{client.job}"

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts