Hi,

At Tue, 21 Jan 2003 04:32:59 +0900,
Daniel Carrera wrote:
> $ irb --simple-pompt
> >> foo = "bar" 
> => "bar"
> >> def function
> >>     puts foo
> >> end
> => nil
> >> function
> NameError: undefined local variable or method `foo' for #<Object:0xf9000>
>         from (irb):3:in `function'
>         from (irb):5
> 
> Since 'foo' was defined before 'function' and both 'function' and 'foo' 
> are in the same scope (I think) shouldn't 'function' see 'foo'?

Any methods have each own scopes.

-- 
Nobu Nakada