[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: quick question about @ and @@

darren kirby

5/17/2007 4:29:00 PM

quoth the Mike Steiner:
> What's the difference between @ and @@? Specifically, which should I use if
> I need a global variable in a non-OOP Ruby program?
>
> Thanks!
>
> Mike Steiner

As I understand it, '@' denotes an instance variable, visible only to the
instance of a class, and '@@' is a class variable, visible to all instances
of the class.

If you need a plain old global try: $foovar

-d
--
darren kirby :: Part of the problem since 1976 :: http://badco...
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972