From: kentda@... Date: 2001-10-26T00:34:29+09:00 Subject: [ruby-talk:23307] Re: why the @ s ? On Fri, 26 Oct 2001, Tobias Reif wrote: > > 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? > > It's no class, and all three variables are declared @ the toplevel, so I > thought the @ signs are not necessary. (The vars are no instance vars, > and they are not declared inside control structures that would limit > their scope) You are mistaken, I believe. Even on the "top-level" you are in a class, inside an object instance of Kernel actually, if memory serves me. So they are instance variables. That's all part of the wonderful OO nature of Ruby :-) -- <[ Kent Dahl ]>================<[ http://www.stud.ntnu.no/~kentda/ ]> )____(stud.techn.;ind.�k.data)||(softwareDeveloper.at(Trustix))_( /"Opinions expressed are mine and not those of my Employer, "\ ( "the University, my girlfriend, stray cats, banana fruitflies, " ) \"nor the frontal lobe of my left cerebral hemisphere. "/