Difference between revisions of "RETURN"

From Recital Documentation Wiki
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=RETURN=
 
 
 
==Class==
 
Applications
 
 
 
 
==Purpose==
 
==Purpose==
 
Return from a procedure, function, or program  
 
Return from a procedure, function, or program  
Line 11: Line 4:
  
 
==Syntax==
 
==Syntax==
RETURN [TO MASTER] [<exp>]
+
RETURN [TO MASTER | <exp>]
  
  
Line 31: Line 24:
 
<code lang="recital">
 
<code lang="recital">
 
procedure example_1
 
procedure example_1
do example_2
+
  do example_2
// Returns here <---------------
+
  // Returns here <---------------
 
return
 
return
  
 
procedure example_2
 
procedure example_2
do example_3
+
  do example_3
 
return
 
return
  
 
procedure example_3
 
procedure example_3
if .T.
+
  if .T.
return to master //-------------
+
      return to master //------------^
endif
+
  endif
 
return
 
return
  
Line 50: Line 43:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Applications]]
 +
[[Category:Applications Commands]]

Latest revision as of 10:56, 16 November 2011

Purpose

Return from a procedure, function, or program


Syntax

RETURN [TO MASTER | <exp>]


See Also

FUNCTION, ON ERROR, ON ESCAPE, ON KEY, PROCEDURE, RETRY, SET PROCEDURE


Description

The RETURN statement closes the active program file, releases memory variables and arrays defined as private, and passes control back to the calling program. The RETURN statement is also used to denote the end of a procedure definition.

TO MASTER

If the TO MASTER is specified, then control is passed back to the highest level calling procedure.

<exp>

If the optional <exp> is specified, it will be returned to the calling program if the procedure or function was called as a User Defined Function.


Example

procedure example_1
  do example_2
  // Returns here <---------------
return
 
procedure example_2
  do example_3
return
 
procedure example_3
  if .T.
      return to master //------------^
  endif
return
 
do example_1


Products

Recital Server, Recital