Return Statement

Moves execution back to the code that called a procedure.

Syntax

Non-function construct

Return

Function construct

Return expression

Parts

expression
For a function construct, mandatory value to return to the caller.

Instructions

In procedures of the types Sub and Set (Property), Return is the same as Exit Sub or Exit Property. You must not supply expression.

In procedures of the types Function and Get (Property), Return must include expression. The data type of expression must be compatible with the return type of the procedure. As an alternative, you can assign expression to the name of the procedure, then use Exit Function or Exit Property.

If you put Return in a block of the types Try or Catch that also includes a block Finally, then Return causes Finally to execute. And if Return includes expression, then it gets calculated after End Try. Return is not permitted in blocks of the type Finally.

Examples

TODO

See also