Hex Editor - Binary File Editing Software for Windows
Download Hex Editor Neo Hide this button

?: Conditional Operator

This is the only supported ternary operator. It evaluates to the value of its second operand if the first operand evaluates to non-zero value, otherwise, it evaluates to the value of the third operand.

Syntax:

exp1 ? exp2 : exp3

Usage:

5 == 3 ? 8 : 7               // evaluates to 7
2 == 2 ? 8 : 7               // evaluates to 8