On Apr 17, 2007, at 11:10 PM, progcat / comcast.net wrote:

> Close but not really what I was looking for.
>
> example:
>    if g(x) > f(x)
>    then
>        put "rejoice because f(x) is greater than f(x)"
>    else
>        put "g(x) <= f(x) OR g(x) and/or f(x) returned a nil so I
> wanted to execute this"
>    end.
>
> In other words I want the function to work as it normally would for
> valid values, and if one or both are nil I want to make the test
> evaluate to false.

This is a case where I would use local variables (to avoid evaluating  
f and g more than once). But I would reverse the test because I find  
it easier to understand that way.

<code>
    u, v = f(x), g(x)
    if u.nil? || v.nil? || v <= u
       puts "g(x) <= f(x) or g(x) and/or f(x) returned nil"
    else
       puts "rejoice because f(x) is greater than f(x)"
    end
</code>

Why do you want to avoid using locals? There's nothing shameful in  
using them.

Regards, Morton