📄 m2_do.hlp
字号:
{smcl}
{* 18mar2005}{...}
{cmd:help m2 do}
{hline}
{* index do ... while tt}{...}
{title:Title}
{p 4 4 2}
{bf:[M-2] do -- do ... while (exp)}
{title:Syntax}
{cmd:do} {it:stmt} {cmd:while (}{it:exp}{cmd:)}
{cmd:do} {cmd:{c -(}}
{it:stmts}
{cmd:{c )-} while (}{it:exp}{cmd:)}
{p 4 4 2}
where {it:exp} must evaluate to a real scalar.
{title:Description}
{p 4 4 2}
{cmd:do} executes {it:stmt} or {it:stmts} one or more times, until {it:exp} is
zero.
{title:Remarks}
{p 4 4 2}
One common use of {cmd:do} is to loop until convergence:
{cmd}do {
lasta = a
a = get_new_a(lasta)
} while (mreldif(a, lasta)>1e-10){txt}
{p 4 4 2}
Note that the loop is executed at least once, and that the conditioning
expression is not executed until the loop's body has been executed.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-2] do}
{p 4 13 2}
Online: help for
{bf:{help m2_for:[M-2] for}},
{bf:{help m2_while:[M-2] while}},
{bf:{help m2_break:[M-2] break}},
{bf:{help m2_continue:[M-2] continue}};
{bf:{help m2_intro:[M-2] intro}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -