Terminate a procedure, user-defined function, or program

     RETURN [<exp>]


     <exp> is an expression of any type that evaluates to the return
     value for user-defined functions.  If a user-defined function terminates
     without executing a RETURN statement, the return value is NIL.


     RETURN terminates a procedure, user-defined function, or program by
     returning control to either the calling procedure or user-defined
     function.  When RETURN executes in the highest level procedure, control
     passes to the operating system.  All private variables created and local
     variables declared in the current procedure or user-defined function are
     released when control returns to the calling procedure.

     There can be more than one RETURN in a procedure or user-defined
     function.  A procedure or user-defined function need not, however, end
     with a RETURN.  Since user-defined functions must return values, each
     must contain at least one RETURN statement with an argument.

     Note:  A procedure or user-defined function definition is terminated
     by a PROCEDURE statement, a FUNCTION statement, or end of file but not
     by a RETURN statement.


     .  Arrays: Since array is a data type like any other data type,
        instances of array type are really values like character strings and,
        therefore, can be RETURNed from a user-defined function.

     .  RETURN TO MASTER: Clipper does not support RETURN TO MASTER
        or any other form of RETURN specifying the level to which the call is
        to return.  You can, however, simulate these operations with BEGIN


     .  These examples illustrate the general form of the RETURN
        statement in a procedure and in a user-defined function:

        PROCEDURE <idProcedure>

        FUNCTION <idFunction>
           RETURN <expReturn>

     .  This example returns an array, created in a user-defined
        function, to a calling procedure or user-defined function:

        FUNCTION PassArrayBack
           PRIVATE aArray[10][10]
           aArray[1][1] = "myString"
           RETURN aArray


2 responses to “C5_RETURN

  1. Pingback: C5 Flow Control | Viva Clipper !

  2. Pingback: C5 Statements | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.