class Sample
attr_accessor :x,:y
def initialize
@x = "x"
y = "y"
end
end
Sample.new.instance_variables => [:@x]
class Sample
attr_accessor :x,:y
def initialize
@x = "x"
self.y = "y"
end
end
Sample.new.instance_variables => [:@x, :@y]
Can anyone let me know what is going on here. Why is y an instance_variable second time?