Next: The switch statement Up: Conditionals Previous: The if statement

The ? operator

The ? (ternary condition) operator is a more efficient form for expressing simple if statements. It has the following form:

It simply states:

if expression then expression else expression

For example to assign the maximum of a and b to z:

which is the same as:
Fri May 20 13:40:49 BST 1994