return

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


Syntax diagram for the return statement

returnValue

An item, literal, or constant that is compatible with the returns specification in the EGL function declaration.

Although an item 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 that includes only single-byte characters can be returned only if the primitive type in the returns specification is CHAR or MBCHAR

  • A literal or constant that includes only double-byte characters can be returned only if the primitive type in the returns specification is DBCHAR

  • A literal or constant that includes a combination of single- and double-byte characters can be returned only if the primitive type in the returns specification is MBCHAR

  • A literal or constant cannot be returned if the primitive type in the returns specification is HEX

A function that includes a returns specification must terminate with a return statement that includes a value. A function that lacks a returns specification may terminate with a return statement, which must not include a value.

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