From: Jeroen Lodewijks Date: 2012-09-19T22:03:07+09:00 Subject: Re: Class variables Jan E. wrote in post #1076455: > class Test { > > int var = 5; > > void show() { > System.out.println(var); > } > > } Hi all, This is exactly the question that I also wanted to ask, being new to Ruby. I just registered 5 min ago and see almost the first post is the very same probem. What I want to do achieve is: I want a variable known throughout the scope of the class but that is *not* always the same variable if you instanciate a new object of the class (I like to achieve what the java code above does). For instance: class Test var = 5 def show puts var end def set(value) var = value end end test1 = Test.new test1.set 10 test2 = Test.new test2.set 20 test1.show test2.show Should show 10 and 20 How do I do this? -- Posted via http://www.ruby-forum.com/.