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.

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad