From: "Thomas B." Date: 2008-09-01T22:10:03+09:00 Subject: Re: accessing instance variable Robert Klemme wrote: > You are not defining an instance variable of instances of O here but > of O itself. In other words this @b and the @b below have nothing to > do with each other. Exactly. And if you want to initialize @b for each new instance of O to the value of 0, you should write class O def initialize @b = 0 end def x=(a) @b = a end attr_reader :b end Now all new instances will have @b equal to 0. And the attr_reader is for reading the instance variables. In fact attr_reader :b is the same as writing explicitly def b @b end TPR. -- Posted via http://www.ruby-forum.com/.