Skip to main content
Previous sectionNext section

Return

Exits from the current function and returns a value from that function.

Synopsis

Return expression

Arguments

The Return statement syntax has these parts:

expression Any numeric or string expression.

Description

You use the Return statement to stop execution of a function and return the value of expression. If no Return statement is executed from within the function, the expression that called the current function is assigned the value undefined.

Examples

The following example illustrates the use of the Return statement:

Function IsGreaterThan(lower, upper)
If lower > upper Then
    Return False
ElseIf lower = upper Then
    Return False
Else 
    Return True
End If
End Function
Copy code to clipboard

See Also