Consider the following sample ruby class
class User
def hello
puts "hello"
end
end
now, for initialization. there are two ways
normal variable
1.9.3p125 > tr = User.new
=> #<User:0x98778c4>
1.9.3p125 > tr.hello
Hello world
=> nil`
Instance variables:
1.9.3p125 > @tr = User.new
=> #<User:0x9890f2c>
1.9.3p125 > @tr.hello
Hello world
=> nil
Now, in both cases it works the same. so what is the difference between normal variable vs instance variable?