A ternary operator is some operation operating on 3 inputs. It’s a shortcut for an if-else statement, and is also known as a conditional operator.
- In Perl/PHP it works as: “boolean_condition?true_value:false_value”
- In C/C++ it works as: logical expression? action for true : action for false