21. 4GL Statement Glossary : Return
 
Share this page                  
Return
Closes the current frame and returns to the calling frame; also returns a value from a 4GL procedure or frame.
Syntax
return [expression]
expression
Specifies a single-valued expression. Its data type must be compatible with that of the field to which its value is assigned. Declare its return data type when you define the frame or procedure containing this return statement in ABF.
Description
The 4GL return statement returns you to a calling 4GL frame from a called frame or procedure.
In returning from a called frame, return closes the current frame and returns control to the frame that called it with a callframe statement. The calling frame resumes execution at the statement following callframe. If the current frame was the first one when the application started up, the return statement closes the entire application, functioning as an exit statement.
The return statement has the same effect when executed within a submenu as it has within the main menu of a frame. In returning from a called procedure, return passes control back to the calling frame, which resumes execution at the statement following callproc.
The return statement can pass a value back to the frame that called the current frame or procedure. You can use this feature to transmit a return status back to the calling frame. For information on returning a value to the top frame, see Returning to the Top Frame.
The return statement can return only simple data types. For example, you cannot return a record, but you can return a record attribute of a simple datatype.
Example
The return operation returns control to the calling frame, passing back the value in the field called Status:
'End' = 
begin 
  return status; 
end