Returns control to the code that called a Sub, Function, or Property procedure.
Return
-or-
Return expr
For a Sub procedure or a Property procedure that sets the property's value, the Return statement is equivalent to an Exit Sub statement, and expr must not be supplied.
For a Function procedure or a Property procedure that retrieves the property's value, expr must be present and must evaluate to a data type that is convertible to the return type of the function. In this form, Return is equivalent to assigning the expression to the function name as the return value and then executing an Exit Function statement.
This example uses the Return statement several times to return to the calling code when the procedure does not need to do anything else.
Public Function GetAgePhrase(Age As Integer) As String If Age > 60 ThenReturn
"Senior" If Age > 40 ThenReturn
"Middle-aged" If Age > 20 ThenReturn
"Adult" If Age > 12 ThenReturn
"Teen-aged" If Age > 4 ThenReturn
"School-aged" If Age > 1 ThenReturn
"Toddler"Return
"Infant" End Function