Nomenclature Issue

Why Ternary operator in not called a binary Operator or ternary Operands ?

question ? answer1 : answer2 When it takes 2 operators ?

Answered by darkpaw in 847440022

It's basically: if a then b else c which is three parts.

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

  • Types of operators:
  • Arithmetic: +, -, *, /
  • Comparison: ==, !=, >, <
  • Logical: &&, ||, !
  • Assignment: =, +=, -=

Operands is [a-z], [A-Z]

It brings confusion from Maths to Programming

in Swift https://docs.swift.org/swift-book/documentation/the-swift-programming-language/basicoperators/#Ternary-Conditional-Operator

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"

Nomenclature Issue
 
 
Q