return statement

The return statement is a control directive that returns control normally to the caller of a function, class, getter, or setter. In the case of a getter or non-void function, it also specifies the return value.

Usage

For getters or non-void functions, a return statement specifies a a result expression:

// ...within a getter or function
return resultExpression;

For void functions, classes, or setters, no result expression is given:

// ...within a void function, class, or setter
return;

Description

Execution

The result expression, if any, is evaluated, and then execution resumes with the caller of the value getter or function.

See also