From: Bernhard 'elven' Stoeckner Date: 2006-03-09T06:43:42+09:00 Subject: Re: globals outside of OO scripting rtilley wrote: > When writing methods as functions (I know they're methods pretending to > be functions) do you still need to use globals... like this: > > $global_var > def some_other_function > ... > $global_var > end > > Or, is it OK to use them like this: > > global_var > def some_other_function > ... > global_var > end No, you still need to use either global or instance variable syntax, since it is, as you correctly state, still a class. def some_other_function @n = 1 $m = 2 end def some_other_function2 puts @n puts $m end some_other_function some_other_function2