From: Daniel Harple Date: 2006-03-15T07:36:28+09:00 Subject: Re: Scope of an @variable On Mar 14, 2006, at 11:18 PM, Nathan Olberding wrote: > I was under the impression (newbie alert) that @name was for instances > and @@name was for classes as a whole (ie, @@ variables change that > value in all instances of Class). Is there a way to have variables > that > apply to all instances of a Class? Use an initialize method: class Person def initialize(name="Anonymous") @name = name end attr_accessor :name def to_s "My name is #{@name}" end end person = Person.new puts person # -> My name is Anonymous person.name = "Fred" puts person # -> My name is Fred This should help you: http://ruby-doc.org/docs/ProgrammingRuby -- Daniel