Why Ternary operator in not called a binary Operator or ternary Operands ?
question ? answer1 : answer2 When it takes 2 operators ?
Why Ternary operator in not called a binary Operator or ternary Operands ?
question ? answer1 : answer2 When it takes 2 operators ?
It's basically: if a then b else c
which is three parts.
And it’s by extension from binary operation, which is the standard term for the +
in a + b
.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
I believe, Instead of ternary conditional operator it should be ternary conditional operation as three input operands is called ternary operation in mathematics
as
Operator is
Operands is [a-z], [A-Z]
It brings confusion from Maths to Programming
It’s a conditional operator that takes three inputs, so calling it ternary conditional operator doesn’t seem like a big stretch.
Regardless, I’m not the person you need to convince here. If you want to discuss this with Swift language folks, I recommend that you bounce over to Swift Evolution.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"