| MATLAB Function Reference | Search  Help Desk |
| return | Examples See Also |
Return to the invoking function
return
return
causes a normal return to the invoking function or to the keyboard. It also terminates keyboard mode.
If the determinant function were an M-file, it might use a return statement in handling the special case of an empty matrix as follows:
function d = det(A)
%DET det(A) is the determinant of A.
if isempty(A)
d = 1;
return
else
...
end
break Terminate execution of for or while loop
disp Display text or array
end Terminate for, while, switch, try, and if statements
or indicate last index
error Display error messages
for Repeat statements a specific number of times
if Conditionally execute statements
keyboard Invoke the keyboard in an M-file
switch Switch among several cases based on expression
while Repeat statements an indefinite number of times