From: David Alan Black Date: 2001-10-26T01:25:20+09:00 Subject: [ruby-talk:23314] Re: why the @ s ? Hello -- On Fri, 26 Oct 2001, Tobias Reif wrote: > 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 > -------------------- Did you try calling fred? :-) > > works: > -------------------- > var01 = 'var01' > > def print_var var > print var > end > > print_var var01 #=> prints 'var01' > -------------------- Here you've returned to the scope in which you started, so var01 is defined and can be used. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav