From: "v.nainar" Date: 2005-09-28T15:03:58+09:00 Subject: class variables Hello! What is wrong with the following code? Why is @@id incremented before and not after the assignment? . ( Sorry if this sounds silly and I have overlooked something obvious ) #!/usr/local/bin/ruby class Foo @@id=1 def initialize(s) @s=s @id=setId() end def setId() @id=@@id @@id+=1 end end foo1=Foo.new("one") foo2=Foo.new("two") foo3=Foo.new("three") p foo1,foo2,foo3 Output -> # # why is @id not 1 # # and 2 # # and 3 ?