The Conditional Operator ?: – Basic Elements, Primitive Data Types, and Operators

2.18 The Conditional Operator ?: The ternary conditional operator ?: allows conditional expressions to be defined. The conditional expression has the following syntax: condition ?expression1 :expression2 It is called ternary because it has three operands. If the boolean expression condition is true, then expression1 is evaluated; otherwise, expression2 is evaluated. Both expression1 and expression2 must evaluate to … Read more