It has been long topic now, and very helpful, I must admit I really love 
the Ruby Community, such Community is hard to find other places :)

I want to thanks everyone very much :)

------------------------------------------

I think now I understand completely why the following code below is 
throwing exception:

puts myvar
# register.rb:1: undefined local variable or method 'myvar' for 
main:Object

Ruby don't know what "myvar" is, it could not find any local variable 
with that name, or any method in the main:Object (base class)

------------------------------------------

The code below would not throw any exception:
puts @myvar
# nil

Ruby already know whatever start with @ would be instance of something, 
if not then it would still be nil object, means false.

puts @myvar.class.to_s
# NilClass

puts @myvar="string".class.to_s
# String

---------------------

The Accessors only provide you with the set and get properties similar 
to other languages, when you declare something like this:

attr_accessor :myvar

You would have an instance of nil object.

class A
   attr_accessor :myvar
end

a = A.new
p a.myvar.class.to_s
# NilClass

p a.myvar=2.class.to_s
# Fixnum

p a.myvar='string'.class.to_s
# String

---------------------

Why does Ruby treat @myvar different from myvar?

> Posted by  unknown (Guest) on 04.04.2007 15:30 
> Exactly why it does that with instance variables and not with local variables
> I don't know, but they are used in different enough ways that the difference 
> should not be bothersome.

The answer:

> Posted by  Brian Candler (Guest) on 04.04.2007 15:44 
> That's because both method names and local variable names fall into the same name space

---------------------

I thank again everyone :D

My sister just asked me today "Who is Ruby, is she your girlfriend?" LOL

-- 
Posted via http://www.ruby-forum.com/.