From: Brian Adkins Date: 2007-10-26T22:15:01+09:00 Subject: Re: Skip the first invocation e.g. skip_first { foo } On Oct 25, 7:35 pm, "ara.t.howard" wrote: > On Oct 25, 2007, at 4:40 PM, Brian Adkins wrote: > > > first = true > > 3.times do > > if first > > first = false > > else > > puts 'foo' > > end > > ... > > end > > as others have mentioned you can use the block counter that's passed > - but in general i've done things like this before: > > cfp:~ > cat a.rb > block = lambda{ block = lambda{ puts 'foo' } } > 3.times{ block.call } Clever :) I've used a similar technique in JavaScript, but I don't like defining the code outside of the loop, and it's also not as clear as other solutions IMO.