Hello --

On Fri, 12 Apr 2002, William Djaja Tjokroaminata wrote:

> Just one clarification that remains: Is it true that we should never,
> EVER, use the "return" statement in a code block in Ruby?
>
> For example,
>
>     def debug ()
>       if @debugging
>         data = yield
>         puts "data = #{data}"
>         .... # do processing with data[0], data[1], ..., data[n]
>       end
>     end
>
>     debug () {return a, b, c}
>
> This does not work!

Yeah, I've been bitten by that on occasion.  It returns from the
yielder, not the yieldee.  You'd need to just put the value you
want:

  debug { [a,b,c] }


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav