Hi,
on my journey from Rubynewbie to Whoknowswhat, I'm having difficulties
in understanding variable scope.
In
http://www.rubynewbies.com/~tobi/howto/show_source.rb?file=show_source.rb&format=.xhtml
http://www.rubynewbies.com/~tobi/howto/show_source.rb?file=show_source.rb&format=.txt
I declare 3 variables whose name starts with an @ sign. When I omit any
of the three @ signs, the Program doesn't work anymore.
Why?
It's no class, and all three variables are declared @ the toplevel, so I
thought the @ signs are not necessary. (The vars are no instance vars,
and they are not declared inside control structures that would limit
their scope)
I wonder if it's too obvious or too complex to get it myself...
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/