Home News DOC Class DL Others Cooker
Documents  >  Tutorial  >  returnstatement
return statement

Purpose of this chapter.

We will learn about the return statement.

Return from a member.

The execution of the member is stopped by a return statement. and, the control of the execution is returned to the invoker of the member.

If there is a expression after the 'return' keyword, the return statement returns an instance that is generated by the expression. If there is not a expression, the return statement returns an instance of the void class.

A return statement is the following format.

return ;

return expression ;

return keyword

The 'return' keyword indicates that this statement is a return statement.


This expression generates an instance that is returned to the invoker. If the return value is not, it can be omitted.

The type of instance that is returned must match the return value type of the caller.

If a specification of the return value type is not to the caller or the void class is specified to the return value type of the caller, the return statement must not return a value.

The end of the return statement.

The end of the return statement is represented by a semicolon.

Copyright © Rice All rights reserved.