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:
Wed Sep 14 10:06:31 BST 1994