From: Kent Dahl Date: 2002-10-17T01:43:54+09:00 Subject: Re: passing on a block Philipp Meier wrote: > > On Tue, Oct 15, 2002 at 03:18:29AM +0900, John Tromp wrote: > > def each(&b) > > nstates.times(&b) > > end > > > > Which is the better or more Ruby-esque way? > > Any difference in efficiency? > > I would take the latter because of does not hard codes the arity of > #times. I thought of method arity when I first read your sentence, so just to be terribly pedantic, I'd suggest: def each(*args,&b) nstates.times(*args,&b) end -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 5. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)