Rha
2/14/2008 10:07:00 PM
|| operator return true if at least one of the operands is true, so:
false || false || true returns true, and hello is printed.
false || false returns false and thus, nothing is printed (nil).
Note: || operator stops evaluating when the first true yielding
expression is found.
On Fri, 8 Feb 2008 19:39:06 -0500, fw <fwmailinglists@gmail.com>
wrote:
>On Sat, 2008-02-09 at 09:28 +0900, John Maclean wrote:
>> Hey chaps,
>>
>> Is is at all possible to have a statement such as
>>
>> p "some string " if ( stuff || more_stuff || other_stuff)
>>
>>
>>
>
>I'm not sure what I'm missing here:
>
>$ irb
>irb(main):001:0> p "hello" if (false || false || true)
>"hello"
>=> nil
>irb(main):002:0> p "hello" if (false || false)
>=> nil
>
>
>HTH,
>
>Felix
>