Proper Statements as Expressions
Date: 2020-10-07 18:10:00

Up | Prev | PrevTail | Tail

### 3.5 Proper Statements as Expressions

Several kinds of proper statements deliver an algebraic or numerical result of some kind, which can in turn be used as an expression or part of an expression. For example, an assignment statement itself has a value, namely the value assigned. So

2 * (x := a+b)

is equal to 2*(a+b), as well as having the “side-eﬀect” of assigning the value a+b to X. In context,

y := 2 * (x := a+b);

sets X to a+b and Y to 2*(a+b).

The sections on the various proper statement types indicate which of these statements are also useful as expressions.

Up | Prev | PrevTail | Front