From: Tobias Reif Date: 2001-10-26T01:07:17+09:00 Subject: [ruby-talk:23311] Re: why the @ s ? Dave, thanks for your explanation. But I'm still confused: (thanks for your patience) > a = 10 > def fred > p a #=> -:3:in `fred': undefined local variable or method `a' > end with ruby 1.6.3 (2001-03-19) [i386-cygwin] : -------------------- a = 10 def fred p a #=> no error end -------------------- works: -------------------- var01 = 'var01' def print_var var print var end print_var var01 #=> prints 'var01' -------------------- doesn't: -------------------- var01 = 'var01' def print_var01 print var01 end print_var01 # 18:in `print_var01': undefined local variable or method `var01' for # # (NameError) -------------------- In the last example: how could I make it work without adding an @ sign? Smething like Object.new.print_var01 print_var01() ... in the last line? Since print_var01 is defined as method just above; why doesn't Ruby treat it as such? Tobi -- Tobias Reif http://www.pinkjuice.com/myDigitalProfile.xhtml go_to('www.ruby-lang.org').get(ruby).play.create.have_fun http://www.pinkjuice.com/ruby/