FRETURN

Return a value to the calling routine

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
FRETURN expression

Arguments

expression

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

Discussion

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).

Examples

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