RETURN Command

Returns program control to a calling program.

RETURN [eExpression | TO MASTER | TO ProcedureName]

Parameters

  • eExpression
    Specifies an expression returned to the calling program. If you omit RETURN or the return expression, true (.T.) is automatically returned to the calling program.
  • TO MASTER
    Returns control to the highest-level calling program.
  • TO ProcedureName
    Specifies the procedure to which control is returned.

Remarks

RETURN terminates execution of a program, procedure, or function and returns control to the calling program, the highest-level calling program, another program, or the Command window.

Visual FoxPro releases PRIVATE variables when RETURN is executed.

RETURN is usually placed at the end of a program, procedure, or function to return control to a higher-level program. However, an implicit RETURN is executed if you omit RETURN.

Example

In the following example, the function longdate returns a character string that is suitable for printing from a date.

SET CENTURY ON
? longdate({^1998-02-16})  && Displays Monday, February 16, 1998

FUNCTION longdate
PARAMETER mdate
RETURN CDOW(mdate) + ', ' + MDY(mdate)

See Also

DO | FUNCTION | LPARAMETERS | PARAMETERS | PARAMETERS( ) | PRIVATE | PROCEDURE | PUBLIC