An instance variable doesn't get created until it is first assigned. So in this case, you
have to call `hello` before @v will show up in `self.instance_variables`:

puts self
=> main
def hello
@v = 1
end
=> nil
puts self.instance_variables
=> nil
hello
=> 1
puts self.instance_variables
=> @v
=> [:@v]

Michael Edgar
adgar / carboni.ca
http://carboni.ca/

On May 16, 2011, at 8:54 PM, Brian Xue wrote:

> Can anyone help explain?
> 
> Many thanks!
> 
> Brian