Return statement
From Free net encyclopedia
In computer programming, the use of the 'return' keyword resumes execution at the point of the last call by reference to the top of the process' stack. Functions however can return a value to the code that called the function.
In [[C++]], return exp; (where exp is an expression) is a statement of code which tells a function to return the execution, of the program, to the calling function, and report the value of exp. If the function does not have a return type (returns void), the return command can be used without a value to just break out of the current function and return to the calling one, as is the case in most versions of BASIC.
Certain programming languages, such as Perl and Ruby allow the programmer to omit an explicit return statement, specifying instead that the last evaluated expression is the return value of the subroutine. Values returned by the program when it terminates are often captured by Batch Programs.
Syntax
Return statements come in many shapes. The current syntaxes are most common:
return value;
As used in Smalltalk:
^ value
As used in Lisp:
(return value)
As used in BASIC:
RETURN