On Mar 24, 6:52 pm, Timothy Hunter <TimHun... / nc.rr.com> wrote: > > A class variable is NOT the same as an instance variable of the class > object. Have you tried "calling" @@var1 with A.var1? It doesn't work. > The attr_reader and attr_writer methods create methods that operate on > @var1. There is no method "var1" that operates on @@var1. You're right, that method isn't defined in the first case, I've just tried it. It also fails because class variables are required to be initialized, which I didn't do. So how about this? class A @@var1 = 2 def A.var1 @@var1 end end class A class << self @var1 = 2 def var1 @var1 end end end I tried this in irb as well, and again, they're not the same, but I can't figure out why not. This time the first declaration gives A.var1 => 2, while the second gives A.var1 => nil. But what happened to my 2?