From: 7stud -- Date: 2007-09-24T13:59:08+09:00 Subject: Re: how to add an iterator to a class? 7stud -- wrote: > > Here is how a block returns a value to a yield statement: > > def test > result = yield 10 #catch the value returned by the block in a > variable > > puts result > end > > > test {10 * 2} Whoops. That should be: def test result = yield 10 puts result end test {|num| num * 2} #block is defined to accept an arg -- Posted via http://www.ruby-forum.com/.