A return expression return e must occur inside the body of some enclosing named method or function. The innermost enclosing named method or function in a source program, f, must have an explicitly declared result type, and the type of e must conform to it. The return expression evaluates the expression e and returns its value as the result of f. The evaluation of any statements or expressions following the return expression is omitted. The type of a return expression is scala.Nothing.
Syntax: Expr1 ::= ‘return’ [Expr]
The expression e may be omitted. The return expression return is type-checked and evaluated as if it was return().
Read more, section 6.20.