From: David Alan Black Date: 2002-04-18T06:07:55+09:00 Subject: RE: Ways methods return values Hello -- On Thu, 18 Apr 2002, Jean-Hugues ROBERT wrote: > Hello, > > Would someone please clarify one point ? The "value" of a method call is > the value of the "last" expression evaluated. So far I assumed (but never > checked) that "ensure" block were irrelevant about that (i.e. the > "returned" value would be the "last" one "before" the "ensure"). Apparently > I was wrong. That slightly bothers me. I would however agree that an > explicit "return" inside an "insure" section should "override" the returned > value of the main block. What is actually happening ? I think you're right: irb(main):030:0> def thing; ensure "bye"; end nil irb(main):031:0> thing nil irb(main):032:0> def thing; ensure return "bye"; end nil irb(main):033:0> thing "bye" David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav