📄 mf_exit.hlp
字号:
{smcl}
{* 31mar2005}{...}
{cmd:help mata exit()}
{hline}
{* index exit()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] exit() -- Terminate execution}
{title:Syntax}
{p 8 12 2}
{cmd:exit(}{it:real scalar rc}{cmd:)}
{p 8 12 2}
{cmd:exit()}
{title:Description}
{p 4 4 2}
{cmd:exit(}{it:rc}{cmd:)} terminates execution and sets the overall
return code to {it:rc}.
{p 4 4 2}
{cmd:exit()} with no argument specified is equivalent to {cmd:exit(0)}.
{title:Remarks}
{p 4 4 2}
Do not confuse {cmd:exit()} and {cmd:return}. {cmd:return} stops
execution of the current function and returns to the caller, whereupon
execution continues. {cmd:exit()} terminates execution.
For instance, consider
{cmd}function first()
{
"begin execution"
second()
"this message will never be seen"
}
function second()
{
"hello from second()"
exit(0)
}{txt}
{p 4 4 2}
The result of running this would be
: {cmd:first}
begin execution
hello from second()
{p 4 4 2}
If we changed the {cmd:exit(0)} to be {cmd:exit(198)} in {cmd:second()}, the
result would be
: {cmd:first}
begin execution
hello from second()
r(198);
{p 4 4 2}
Note that no error message is presented. If you want to present an error
message and exit, you should code {cmd:exit(error(198))}; see
{bf:{help mf_error:[M-5] error()}}.
{title:Conformability}
{cmd:exit(}{it:rc}{cmd:)}:
{it:rc}: 1 {it:x} 1
{title:Diagnostics}
{p 4 4 2}
{cmd:exit(}{it:rc}{cmd:)}
and
{cmd:exit()}
do not return.
{title:Source code}
{p 4 4 2}
Functions are built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] exit()}
{p 4 13 2}
Online: help for
{bf:{help mf_error:[M-5] error()}};
{bf:{help m4_programming:[M-4] programming}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -