9.86 Void

When an expression is not in a value context, it is given type Void. For example, in the expression

r := (a; b; if c then d else e; f)

values are used only from the subexpressions c and f: all others are thrown away. The subexpressions a, b, d and e are evaluated for side-effects only and have type Void. There is a unique value of type Void.

You will most often see results of type Void when you declare a variable.

a : Integer

Void

Usually no output is displayed for Void results. You can force the display of a rather ugly object by issuing )set message void on.

)set message void on
b : Fraction Integer
\[\]
“()”

Type: Void

)set message void off

All values can be converted to type Void.

3::Void

Void

Once a value has been converted to Void, it cannot be recovered.

% :: PositiveInteger
Cannot convert from type Void to PositiveInteger for value "()"