Prev Up Next
Go backward to Procedure Calls
Go up to Statements
Go forward to If Statements

Return Statements

< return statement > -> return ;
| return < expression > ;

A return statement causes return of control to the caller of the procedure in which it is executed. Executing a return statement in the main program causes program termination.

Return statements placed in procedures that are not functions may not include an expression. Return statements placed in functions must include an expression of type integer. This expression is evaluated and its value returned as the value of the function call.

There is an implicit return statement at the end of the body of each procedure that is not a function.


Computer Science 434
Department of Computer Science
Williams College

Prev Up Next