From: Lloyd Linklater Date: 2008-09-02T22:24:16+09:00 Subject: Re: About class variable question? Zhao Yi wrote: > Please see this code below. It will get "can't convert nil to string > error". Why can't the @name be assigned? I have set the @name = "world". > > class Hello > @name="world" > def say > puts "Hello "+@name > end > end > h=Hello.new > h.say Try it this way: class Hello @@name="world" def say puts "Hello "+@@name end end h=Hello.new h.say -- Posted via http://www.ruby-forum.com/.