in reply to Re: Ternary operator (there's no Trinary operator )
in thread Ternary operator (there's no Trinary operator )

Heh. Just because it's in the Camel book doesn't mean it's right!

I started writing C code over 20 years ago and as far as I can recall, I have never heard it called anything else than the ternary operator outside Perl. I've lost my copies of K&R, both editions 1 and 2, so I can't look it up. Stroustrup side-stepped the issue in C++ and called it a conditional statement.

My own take on the matter is that calling it trinary is never going to go anywhere; the other terminology is too well entrenched, much the same way that programmers jump up and down in anger when the mainstream media refers to black-hats as "hackers", instead of the more semantically precise term "crackers". It's a lost cause.

• another intruder with the mooring in the heart of the Perl

  • Comment on Re^2: Ternary operator (there's no Trinary operator )

Replies are listed 'Best First'.
Re^3: Ternary operator (there's no Trinary operator )
by ikegami (Patriarch) on Jul 19, 2006 at 14:49 UTC
    Stroustrup side-stepped the issue in C++ and called it a conditional statement.

    I call it the conditional operator (or the ternary conditional operator to avoid confusion). "Ternary operator" (or "trinary operator") is a description, not a name. Calling it the ternary operator is like calling me "Laurie Brine's child" in favour of using my name.

    Update: Hey! perlop calls it that too!