resume
リターンまたは復帰実行およびローカル変数をコピー
呼出し手順
resume [x1,..,xn] = resume(a1,..,an)
引数
- x1,..,xn
コール側の環境の変数
- a1,..,an
ローカル変数
説明
関数内で resume は関数の実行を中断します.また,
[..]=resume(..) は関数の実行を中断,
ローカル変数aiをコールした側の環境の
名前xiに代入します.
pause モードの場合, より低いレベルに戻ることができます.
[..]=resume(..)はより低いレベルに戻り,
ローカル変数aiをコールした側の環境の
名前xiに代入します.
関数によりコールされるexecstrの場合,
[..]=resume(..) はその関数の実行を停止し,
ローカル変数aiをコールした側の環境の
名前xiに代入します.
resume は returnと等価です.
![]() | 注意: この機能を使用すると,コードが複雑化する可能性があります.
代わりに, function b=foo()構文が推奨されます. |
例
function foo(a) a=a+1 b=resume(a) c=52 endfunction foo(42); assert_checkequal(b,43); // c does not exist
// with several function calls function foo1() a=1; b=2; c=3; [x,y,z]=resume(a, b, c) endfunction function foo2() foo1() x, y, z // Declared endfunction foo2() // x y z does not exist here
参照
履歴
| バージョン | 記述 |
| 6.0.0 | resume is now protected:
Assignments like resume=1 are no longer possible. |
| Report an issue | ||
| << pause | Control flow | return >> |
