From: Morton Goldberg Date: 2007-08-30T10:22:28+09:00 Subject: Re: How does ruby handle scope and closure in this case? On Aug 29, 2007, at 8:25 PM, grocery_stocker wrote: > How come when I do something like > > #!/usr/bin/ruby -w > > def n_times(thing) > return thing > end > > pi = n_times(23); > puts pi > > the variable 'thing' doesn't go out of scope. I think it does. The variable 'thing' from #n_times is not visible at top level. If you were to do puts thing at this point, you would get an error. Regards, Morton