2.19 Return

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 ctrC. return expr; can be used to continue execution after an error. What happens with the value expr depends on the particular error.

Previous Up Top Next
Index

GAP 3.4.4
April 1997