How about:

def getAValue
  result = methodOne || methodTwo || methodThree
  return result
end

Routines are called in seqeunce until a non-nil result is returned.

As for try____, if it works for you, by all means use it. That's one of the
great things about Ruby, it's malleability.

Regards,
  JJ

--
Be Kind, Be Careful, Be Yourself
--
Solid, reliable software at reasonable prices
http://www.johnjohnsonsoftware.com


"Juha Pohjalainen" <voidjump / nic.fi> wrote in message
news:20010530101528.E15296 / lanfear.nic.fi...
> Hiya all again! :-)
>
> As I'm not explaining things or naming things, here is some more
> thougths about "try return" like things.
>
> My original hate of if-then-return comes from code like:
> | result = doTheFooThing
> | if result
> |   return result
> | end
>
> I know, I know; there are shorter versions to do the same thing,
> but that is code I originally used, because I think that:
>  a) variable names should be meaningful words, not just i,j,r or t
>  b) code should be "bug revealing" [bugs can be real bugs or just
>     flaws in thinking]
>  c) coming from VC++ debugging background
>
> Now, after doing that kind of code thousand times (in C++, Java and
> Python; and lately in Ruby; newbie alert - defector) I just thought
> one language could make a difference.
>
> Enter "try-return" names
>
> | tryreturn doTheFooThing
> was my first working name for idea; it tries to to state intention
> "try to return, if that return is meaningful"
>
> | tryturn doTheFooThing
> was my shorter version; really bad one, do not use it; bad bad bad;
> it does not state intention or is not even a word (I think?)
>
> | done? doTheFooThing
> was third name in search for something with meaning for intention
>
> | ifreturn doTheFooThing
> this one was seen in my one mail reply, when looking some oneliner
> done by someone else; intention is there, but is it enough?
>
> | returnif doTheFooThing
> was afterthougth for ifreturn; it has familiarity with return and
> also states iffy part
>
> | some-other-name-not-known doTheFooThing
> what is your name for that if-then-return or assign-return-if
> thing?; feel free to express yourself!
>
> | enough? doTheFooThing
> ??? where did that come from ???
>
> -Jippo
>
> --
>  __________________________________________________________________
> [   pub 1024/951AFAF5 1995/12/12   Juha Pohjalainen <jmp / iki.fi>   ]
> [   fingerprint 41 56 7F F9 8E EC 16 35  BB 42 EF A7 DF 19 FA 31   ]
> [__ http://www.iki.fi/jmp/ ________________ GSM +358 40 570 1179 __]
>