** Next:** Loops
** Up:** Expressions
** Previous:** Dispatch
** Contents**

##

Conditionals

A conditional has the form

if <expr> then <expr> else <expr> fi

The semantics of conditionals is standard. The predicate is evaluated
first. If the predicate is `true`, then the `then` branch is
evaluated. If the predicate is `false`, then the `else` branch is
evaluated. The value of the conditional is the value of the evaluated branch.

The predicate must have static type `Bool`. The branches may have any static types.
To specify the static type of the conditional, we define an operation
(pronounced ``join'') on types as follows. Let `A,B,D` be any types other than `SELF_TYPE`. The *least type* of a set of types means the least element
with respect to the conformance relation .

Let `T` and `F` be the static types of the branches of the conditional.
Then the static type of the conditional is
. (think: Walk
towards `Object` from each of `T` and `F` until the paths meet.)