Xavier Noria
10/6/2007 6:37:00 PM
On Oct 6, 2007, at 8:27 PM, Greg Willits wrote:
> I am used to a language that allows these two forms:
>
> test ? trueStuff
> test ? trueStuff | falseStuff
>
> While I have yet to find a reference that explicitly states this, it
> would appear that ternary statement in Ruby is not allowed to exclude
> the :
That operator is called "ternary" because it needs 3 operands
(addition is a binary operand, the unary minus acts on a single
operand).
> Ok, fine, so I can write something like this:
>
> $debug ? $devLog.info("bla bla bla") :
Write it like this instead:
$devLog.info("bla bla bla") if $debug
-- fxn