FRETURN

Return a value to the calling routine

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
FRETURN expression

expression

An expression whose type is the same as the return type of the function.

The FRETURN statement enables you to specify the return value of a user-defined function and return control to the calling routine. The size of the value returned to the calling routine is the size of the result of the expression.

When FRETURN is used in a ^VAL function, the value specified in the statement should be an integer. If it is not, it is converted to an integer.

If the compiler encounters an FRETURN statement outside of a function, it generates a “Not within function or subroutine” error ($ERR_NOTINSUB).

The following example checks to see if the current paint character needs to be changed to the specified paint character. It returns %TRUE if it changed the paint character or %FALSE if it didn’t.

function chk_paint
    a_paint     ,a
record
    d_val       ,d3
proc
    if (%paint .ne. %decml(a_paint))
      begin
        xcall paint(a_paint)
        freturn (%true)
      end
    freturn (%false)
endfunction