From: klochner Date: 2009-01-29T05:37:39+09:00 Subject: Re: yield vs. return On Jan 28, 3:21 pm, Stefano Crocco Can you give an example of a situation where you think yield is used in place > of return? This way, we'll be able to understand better what you're referring > to and make more useful comments. > > Stefano The calling code would need to be modified to work with yield vs. return. Here's a slightly different example, because I see this a lot with multivariate return values: ##return style, with calling code below def returnfoo return foo1,foo2 end a,b = returnfoo puts a; puts b vs. ##yield style, with calling code below def yieldfoo yield foo1, foo2 end yieldfoo {|a,b| puts a; puts b } What I'm getting at is that I see ruby programmers use yield to essentially return values to the caller, the distinction being whether the block is executed by the caller or by the method (returnfoo/ yieldfoo). It could be done either way because no operations are performed by the method after the yield.