Changes

Jump to: navigation, search

Ruby Variable Scope

No change in size, 21:17, 30 November 2007
Ruby Instance Variables
== Ruby Instance Variables ==
Instance variables are similar to Class variables except that their values are local to specific instances of an object. For example is if a class contains an instance variable called ''@total''. , if one instance of the object changes the current value of ''@total'' the change is local to only the object that made the change. Other objects of the same class have their own local copies of the variable which are independent of changes made in any other objects.
Instance variables are declared in Ruby by prefixing the variable name with a single @ sign:

Navigation menu