Contents | < Browse | Browse >
6G. multiple return values
In E you can return any number of return values (max 3 in
Amiga E because of implementation reasons). How?
RETURN <exp>,<exp>,<exp> (or ENDPROC, of course)
/* whatever computation is needed */
as you can see, there's a new statement of the form:
<var> , ... := <exp>
where <exp> makes mostly only sense as function call.
note two things:
- you can decide yourself how many values you wish to receive.
this makes sense when the first retval is the main one,
and the second/third optional infos, which might only be
important to some callers.
- this form is a _statement_. this means that when you would
call sincos() as part of another expression, only the
first (the regular) return value is used: fun(sincos(1.0))