MRETURN

Return control from a method

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
MRETURN [expression]

Arguments

expression

(optional) An expression whose type is the same as the return type of the method.

Discussion

If the current method is a constructor or destructor, or if its return type is VOID, expression should not be specified. Otherwise, expression should be present and should have a representation that is the declared return type for the method.

In VOID methods (including constructors and destructors), an MRETURN is implied at the end of the method, so you don' t need to specify it. In non-VOID methods, you must specify at least one MRETURN statement; otherwise a compiler error will be generated.

See also

METHOD-ENDMETHOD statement

Example

In the example below, the MRETURN statement returns control from the get method. The MRETURN for the set method is implied.

public class myclass
    private myfield, i4
    public property myproperty, i4
        method get
        proc
            mreturn myfield
        endmethod
        method set
        proc
            myfield = value 
        endmethod
    endproperty
endclass

In the following example, MRETURN does not need to be included, because the method’s return type is VOID.

public method mymethod, void
    p1, i4
    proc
        p1 = 0
    endmethod