|
|
|
|
|
Re: What would happen if we use RETURN clause in Procedure? [message #319956 is a reply to message #319931] |
Tue, 13 May 2008 08:25 |
VEDDETA
Messages: 54 Registered: May 2008
|
Member |
|
|
The RETURN statement immediately ends the execution of a subprogram and returns control to the caller. Execution continues with the statement following the subprogram call. (Do not confuse the RETURN statement with the RETURN clause in a function spec, which specifies the datatype of the return value.)
A subprogram can contain several RETURN statements. The subprogram does not have to conclude with a RETURN statement. Executing any RETURN statement completes the subprogram immediately.
In procedures, a RETURN statement does not return a value and so cannot contain an expression. The statement returns control to the caller before the end of the procedure.
In functions, a RETURN statement must contain an expression, which is evaluated when the RETURN statement is executed. The resulting value is assigned to the function identifier, which acts like a variable of the type specified in the RETURN clause.
Thanks to Michel and Flyboy for providing the information...
Regards, Veddeta
|
|
|