From: Simon Strandgaard Date: 2004-03-23T23:44:37+09:00 Subject: Re: How to pass a given block to a subroutine On Tue, 23 Mar 2004 23:37:14 +0900, ts wrote: >>>>>> "L" == Lothar Scholz writes: > > L> def foo (*args) > > def foo(*args, &block) > > L> subroutine *args > > subroutine(*args, &block) > > L> end > > Guy Decoux Im too slow.. Decoux you are too fast.. ;-) server> ruby a.rb 30 server> expand -t2 a.rb class Example def foo(*args, &block) subroutine(*args, &block) end def subroutine(*arg, &block) block.call(*arg) # want to call the block given to foo end end a = Example.new a.foo(10,20) { |a,b| print "#{a + b}\n" } server> -- Simon Strandgaard