From: grocery_stocker Date: 2007-08-30T09:25:14+09:00 Subject: How does ruby handle scope and closure in this case? 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. But when I do something like #!/usr/bin/ruby def n_times(thing) return lambda{|n| thing * n} end pi = n_times(23); puts pi.call(2) The varialble 'thing' does go out of scope.