From: Dave Thomas Date: 2001-10-26T00:34:26+09:00 Subject: [ruby-talk:23306] Re: why the @ s ? Tobias Reif writes: > I declare 3 variables whose name starts with an @ sign. When I omit any > of the three @ signs, the Program doesn't work anymore. > Why? Because you're sharing the variables between the top level scope and methods defined in that scope. Methods don't have access to the local variables of the surrounding scope: a = 10 def fred p a #=> -:3:in `fred': undefined local variable or method `a' end However, making them instance variables allows them to be shared, as your whole program runs within the scope of an anonymous Object. @a = 10 def fred p @a # OK end Regards Dave