There is no ambiguity in parsing the expression of the form a ? b ? c : d : e
: the only way to parse it is
a ? (b ? c : d) : e
A more interesting parse would be when a conditional expression is used as the last operand, not the middle. Microsoft documentation provides the answer to this:
The conditional operator is right-associative. The expression
a ? b : c ? d : e
is evaluated asa ? b : (c ? d : e)
, not as(a ? b : c) ? d : e
.
However, it is a good idea to at least parenthesize expressions like that, because some readers of your code would need to consult a language reference in order to understand a potentially simple piece of logic.