Class defs won't "end" properly


#1

This code:

class Person
# Set your class variable to 0 on line 3
@@people_count = 0

def initialize(name)
@name = name
@@people_count +1=
end

def self.number_of_instances
end
end
matz = Person.new("Yukihiro")
dhh = Person.new("David")

puts "Number of Person instances: #{Person.number_of_instances}"

gives these error messages:

(ruby):6: syntax error, unexpected '=', expecting keyword_end
(ruby):18: syntax error, unexpected $end, expecting keyword_end


#2

On this line:

@@people_count +1=

If you change "+1=" to "+= 1", does it solve the issue?


#3

That, plus adding @@people_count to the .number_of_instances def