- $global variables are available from anywhere in the program--no matter the object or method, $global will be available.
- $local variables are only available with the limited context in which they are defined--within a method or block, or if defined outside of a method or block, within whatever self is (a class or module or main).
- @instance variables are available anywhere within a specific instance of an object.
- @@class variables are common to all instances of a class. They can be used to count the instance of a class, as shown in the figure above.
Saturday, March 21, 2009
Ruby Variables
Subscribe to:
Post Comments (Atom)
1 comment:
Guy! Tim,
That is a remarkably clear figure. Thanks.
Tim (yes the guy who drew the figure)
Post a Comment