A real variable starts at the @, its scope is limited to the self object. Two different objects, even if they belong to the same class, can have real variables of different values. From outside the object, the real variable cannot be changed or even observed (for example, Ruby's real variable is never public), Unless the method is explicitly stated by the programmer. Like global variables, the value of a real variable before its inception is nil.
Ruby's real variables need not be declared. This implies the elastic structure of the object. In fact, each real variable is dynamically added to the object at the first occurrence.
Ruby> class Insttest
| def set_foo (n)
| @foo = n
| end
| def set_bar (n)
| @bar = n
| end | End
Nil
ruby> i = insttest.new
#<insttest:0x83678>
ruby> I.set_foo (2) #
2
ruby> i
#<insttest:0x83678 @foo =2>
ruby> i.set_bar (4)
4
ruby> i
#< insttest:0x83678 @foo =2, @bar =4>
Note that the value of @bar is reported in the previous example until the Set_bar method I was called.