# What’s the difference between ternary and tertiary?

### What’s the difference between ternary and tertiary?

Rate This

The conditional operator ( condition ? consequence : alternative ) is often referred to as both the “ternary operator” and the “tertiary operator”. What’s the difference?

Ternary” means “having three parts”. Operators in C# can be unary, binary or ternary – they take one, two or three operands.

“Tertiary” means “third in order”. Compiler flaws noted in bug reports can be of primary, secondary or tertiary importance. Colours can be primary (yellow), secondary (orange) or tertiary (yellowish-orange), like our muppet friend to the left there. And so on.

“Tertiary operator” is therefore an English usage error, unless what you’re trying to say is that the conditional operator is third most important to you, or that it is a lovely greenish-blue colour.

I say avoid the problem altogether; it is simply more clear to call the conditional operator “the conditional operator”.

• I maintain that the correct term is "trinary."  Unary, binary, trinary. Compare unicycle, bicycle, tricycle.

Indeed, the OED lists "trinary" as a synonym for "ternary", but notes that its usage is rare. They were apparently synonyms in Latin as well: trinarius and ternarius both have the sense of "three parts".

You can sometimes tell whether English words have a Latin or Greek origin based on whether the prefixes are uni-, bi-, tri- (Latin) or mono-, di-, tri- (Greek). Had the Romans invented bicycles they would have been unicyclus, bicyclus, tricyclus, as they are in English. The Greeks would have had μονοκύκλος, δικύκλος, τρικύκλος - monokyklos, dikyklos, trikyklos meaning "one circle", "two circle", "three circle" -- Eric

• Is ternary operator primary to && and || conditional (shortcircuit) logical operators?

• So in the statement

x = a + b*c;

is "=" in fact the tertiary operator, because it's the third one to be performed?

Brad the Code Monkey: I think you mean the Lily Tomlin operator.

• I've always been partial to the Midnight Star Operator.

• @bmm6o

it actually brings "Ternary operation - Wikipedia, the free encyclopedia". May be bing should get as intelligent as Google.

• Typical ... to the question of whether it should be called "tertiary" or "ternary", you suggest a third option.

• Basically, ternary or tertiary is not problem, problem is knowledge confusion when we want ot use them 100% accurate manner.

• I think we should *invent* a new operator in C# 5 that takes 3 operands - just to force the disambiguation. A bit like some of the words I'm sure have been invented purely for scrabble ;-p

• Don't you ever wish C# if-then-else was an expression type instead of a statement type so you could write

return if (x < 0) -1 else if (x > 0) +1 else 0;

and do complex nested if-then-else's; multiple lines where appropriate.

Anyway, that's history.