From: Logan Capaldo Date: 2007-08-14T10:40:00+09:00 Subject: Re: Can a lambda or Proc object yield a value to a block? ------=_Part_32339_13894180.1187055603121 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/13/07, Mick Macamhlaoibh wrote: > > I've searched quite a bit on the web and through "Programming Ruby - the > Pragmatic Programmer's Guide" and I can't find a satisfactory answer to > the question: > > Can a lambda or Proc object yield a value to a block? Short answer, no, not yet. (You can in 1.9 by using the & syntax) You actually can use yield in a block, you just need to realize it's the yield of the enclosing scope: def example a_proc = lambda { yield "Hi" } if block_given? a_proc.call end end example { |x| puts x } ------=_Part_32339_13894180.1187055603121--