From: botp Date: 2012-05-26T23:00:35+09:00 Subject: Re: looking for a ruby idiom : r=foo; return r if r On Fri, May 25, 2012 at 9:27 AM, botp wrote: > On Thu, May 24, 2012 at 11:14 PM, Robert Klemme > wrote: >> On Thu, May 24, 2012 at 4:50 PM, botp wrote: >>> thank you all, matt/llelan/robert. >> >> You're welcome! >> >>> r=foo and return r >>> >>> is good, but i think i'll stick w the older if r=foo style...(in the meantime :) >> >> I wouldn't do that, there is a certain risk that it looks like a >> typing error (i.e. someone assumes you meant "if r==foo...").  If I >> would want to use "if" then I'd do > > hmm, dunno. i always do that in C. and besides, coders should always > run their tests.. > >> r = foo >> return r if r > > yap, that was my first code. but the triple r is obviously beggin ;-) > >> But I think the idiom with "and" is superior. :-) > > i want to emphasize the "return" by putting it at the beginning/start > of the line. that is the reason why i was hoping for the if modifier > to work... > > many thanks robert > best regards -botp just ff up in case i'm wrong here. i ended up doing: return r=foo if r would be glad if someone can point some weakness on the above code snippet. best regards -botp