Ternary Operators
The conditional operator (? :) is a ternary operator. This operator needs 3 operands to perform the operation.
Syntax:
Variable = <test expression> ? <expression 1> : <expression 2>
The conditional operator works as follows:
Test Expression is Condition
Expression 1 is Statement Followed if Condition is True
Expression 2 is Statement Followed if Condition is False
The conditional operator (? :) is a ternary operator. This operator needs 3 operands to perform the operation.