return or resume execution and copy some local variables
resume [x1,..,xn] = resume(a1,..,an)
variables in calling environment
local variables
In a function resume stops the execution of the function,
[x1,..,xn]=resume(a1,..,an) stops the execution of the function and put the
local variables ai in calling environment under names
xi.
In pause mode, it allows to return to lower level
[x1,..,xn]=resume(a1,..,an) returns to lower level and put the local variables
ai in calling environment under names xi.
In an execstr called by a function [..]=resume(..) stops
the execution of the function and put the local variables
ai in calling environment under names xi.
resume is equivalent to return.
![]() | Note: the usage of this feature can complexify the code. Instead, the syntax function b=foo() is recommended. |
function foo(a) a=a+1 b=resume(a) c=52 endfunction foo(42); assert_checkequal(b,43); // c does not exist | ![]() | ![]() |
| Version | Description |
| 6.0.0 | resume is now protected:
Assignments like resume=1 are no longer possible. |