RETURN
RETURN xResultadoEnds a function and provides its result to the caller.
Overview
RETURN transfers control back to the caller. Its value follows the function contract: Nil, .T., strings and arrays have different meanings to callers. RETURN inside a loop ends the entire function; Exit ends the relevant loop. Early returns do not replace cleanup. This example adds a small static function with a numeric return and distinguishes returning from printing. (Sources: refs. 1–1.)
Syntax
RETURN xResultadoCommented example
#Include "Protheus.ch"
User Function Ed629()
ConOut(Ed629Sum(2,3))
Return Nil
Static Function Ed629Sum(nA,nB)
Return nA+nBThe helper returns 5 and the main function displays it. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Document return type/meaning and restore areas before returning.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.