Return statement

The EGL return statement exits from a function.

If you want the function to return a value, include a returns clause in the definition, as shown here:
function myFunction() returns (int)
   returns (0);
end

If a function definition does not include a returns clause, the return statement is optional and, if present, cannot include a value.

If a function definition includes a returns clause, the returned value is the default value of the type in either of the following cases:

The default value of type ANY is undefined.

Syntax



Syntax diagram for the return statement

returnValue
A value that is compatible with the type specified in the returns clause.
Here is a type definition used in a subsequent example:
Record MyType 
   myField int;
end
Here is a function that a returns a value of the preceding type:
function myReturnTest() returns(MyType) 
   myRecord Mytype;
   myRecord.myField = 2;     
   return(myRecord);
end

Compatibility

Table 1. Compatibility
Target Issue
Java No issues
JavaScript No issues.