The return statement can be used to terminate the execution of the
function immediately. For example, the following function enters a loop and
repeat some commands untill done is true. It then executes the
return command and terminates the function call.
f = function x -> y
done = 0;
...
while 1
...
if done
y = some_value;
return;
end
...
end
end
The return statement doesn't take any argument.
To return a certain
value, one may assign the value to the output argument prior to the return
statement.
oz
2009-12-22