You are on page 1of 1

Return

By: GAP

 return;

In this form return terminates the call of the innermost function that is currently
executing, and control returns to the calling function. An error is signalled if no function
is currently executing. No value is returned by the function.

 return expr;

In this form return terminates the call of the innermost function that is currently
executing, and returns the value of the expression expr. Control returns to the calling
function. An error is signalled if no function is currently executing.

Both statements can also be used in break loops (see Break Loops). return; has the
effect that the computation continues where it was interrupted by an error or the user
hitting ctr-C. return expr; can be used to continue execution after an error. What
happens with the value expr depends on the particular error.

For examples of return statements, see the functions fib and Stack in
Chapter Functions.

Reference: http://www.gap-system.org/Manuals//doc/htm/ref/CHAP004.htm#SECT023

Date:10-9-2008

You might also like