Tutorial :Difference between tertiary and ternary?


It is my understanding that, the conditional operator ( condition ? consequence : alternative ) is often referred to as both the “tertiary operator” and the “ternary operator”.

What is the difference between these terms?


It should be called the "conditional operator". "Ternary operator" means it accepts three operands. Since it is the only common operator that does that, it's sometimes called "the" ternary operator. The fact that there's only one is a coincidence. "Tertiary operator" is even more wrong. It means something like "third most important operator".


The Tertiary is a geological period, 65 million to 1.8 million years ago.

Seriously, though, "tertiary" means "third in rank" -- not necessarily in value, but maybe sequentially, as in primary, secondary and tertiary education. You want a term that relates to involving three arguments, and that's "ternary", and goes with "binary" and "unary".


"Conditional operator" is the correct name. It is a ternary operator, the only one in many languages, which is why it is sometimes referred to as the ternary operator.

I don't think it's correct to call it "tertiary." That word means something like "the third option," somewhat like primary and secondary would be first and second.


I've never heard about the "tertiary" operator, only "ternary". My guess is it's an abuse of language.


If it is called tertiary, it is erroneously so.

Tertiary means "third [level]" whereas ternary means "having three parts." These are not programming definitions -- just what the words mean.

Clearly, the operator is ternary (1 ? 2 : 3;), but tertiary makes no sense in this case.


One of them is incorrect. Ternary comes from the fact, there are three arguments used (binary operators use two arguments). Tertiary comes from third and is incorrect.


From Wikipedia:

In computer science a ternary operator (sometimes incorrectly called a tertiary operator) is an operator that takes three arguments.

I've never heard it called the "tertiary operator." So, the difference is, using one will make you look like a newbie. I guess.


one is correct and one is incorrect

a ternary operator is an operator with 3 inputs eg a ? b : c , it has arity of 3

a tertiary operator would just mean the 3rd operator? this doesn't really have any significance

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »