It takes three operands:
It takes three operands:
1. Boolean expression (the condition)
2. value if condition is true
3. value if condition is false
The general syntax of the ternary operator is:
<Boolean expr> ? <value if true> : <value if false>
Previous slide
Next slide
Back to first slide
View graphic version