return

The EGL return statement exits from a function and optionally returns a value to the calling function.

A function that includes a returns specification must terminate with a return statement. If you do not specify a return value, EGL will use a default value (the initialization value for the return type), but this is poor coding practice. A function that lacks a returns specification can terminate with a return statement, but that statement must not include a value.

The return statement gives control to the next statement that follows the function call, even if that next statement is in an OnException clause in a try block.

Syntax

Syntax diagram for the return statement
returnValue
A variable, literal, or constant that is compatible with the returns specification in the EGL function declaration. Although the variable must correspond in all ways to the returns specification, the rules for literals and constants are as follows:
  • A numeric literal or constant can be returned only if the primitive type in the returns specification is a numeric type
  • A literal or constant cannot be returned if the primitive type in the returns specification is HEX

Feedback