
return - exiting a procedure

Calling sequence:
return([ expr ... ])

Parameter:

expr   --  expression

Summary:

return terminates a procedure. The arguments of the call are the return values
of the procedure.

Remember: Normally MuPAD ends a procedure after all statements of the
procedure body have been processed.  In this case the return value of the
procedure is the result of the last statement.

In contrast, return effects an immediate exit from the procedure.  The
arguments are evaluated and returned as the return value of the procedure in
the form of an expression sequence. If return is called without a parameter
then a datum of the type DOM_NULL    is returned.

If return is called outside a procedure then the arguments are evaluated and
these are returned as the result of the call. return is a kernel function.

>>  maximum:=proc(x, y) begin

        if x > y then return(x) end_if; y
    end_proc:
    maximum(3, 2), maximum(4, 5);

      3, 5

See also:  error

