Control structures yielding a value

The execution of a paragraph or a choice can also yield a value, namely that of the last unit executed. The paragraph


\begin{elan}
compute sum of integers 1 to 10 ;
that sum + 1
\end{elan}

suggests that first the integers 1, 2, ... 10 are summed up, resulting in a value of 55, and then the value 56 is yielded by that paragraph. If the last unit of a paragraph yields a value, then the paragraph as a whole yields that value.

In case of a choice, the value yielded is that of the paragraph in the then-part or in the else-part, depending on the condition. These values must have the same type. As an example, the unit


\begin{elan}
IF a < b THEN a ELSE b FI
\end{elan}

yields the smaller of the two integer values a and b. Repetitions cannot yield a value.