Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The conditional operator is syntactically right-associative. For instance a?b:c?d:e?f:g is equivalent to a?b:(c?d:(e?f:g)).

Format:

Wiki Markup
   {{ConditionalExpression:}}
            {{ConditionalOrExpression}}
            {{ConditionalOrExpression ? Expression : ConditionalExpression}} \[[JLS Section 15.25 Conditional Operator ? :|AA. Java References#JLS 05]\]
ConditionalExpression:
ConditionalOrExpression
ConditionalOrExpression ? Expression : ConditionalExpression JLS Section 15.25 Conditional Operator ? :

  • If the value of the first operand is true, then the second operand expression is chosen
  • If the value of the first operand is false, then the third operand expression is chosen

...