Conditional Operator (MUX)

The conditional operator ?: corresponds to the MUX operator in the block diagram editor. The operator has the general form (a ? n : m) where a is a boolean, n and m must be of the same type. They can be any primitive type, boolean or arithmetic.

The value of a conditional expression depends on the value of a. If a is true in the above example, the value of the expression is n, otherwise it is m.

The conditional operator is ternary. It ranges behind all binary operators in precedence. Association is from right to left.