From: Christopher Dicely Date: 2009-03-16T06:00:59+09:00 Subject: Re: Problem With eval and each_index On Sun, Mar 15, 2009 at 10:27 AM, Jeff Schwab wrote: > Christopher Dicely wrote: > >> Ruby blocks are closures > > That was not my understanding.  How does one return a block from a function? >  (That's not a rhetorical question; I'm eager to learn.) While block are closures, they aren't first-class. You can't return a block, because its not a normal Ruby object. You can return an instance of class Proc built from a particular block, though, and use it outside the method in which it was created. For example: irb(main):001:0> def counter(seed=0) irb(main):002:1> lambda { seed += 1 } irb(main):003:1> end => nil irb(main):004:0> c = counter(0) => # irb(main):005:0> c.call => 1 irb(main):006:0> c.call => 2