m2_do.hlp

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· HLP 代码 · 共 63 行

HLP
63
字号
{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 + =
减小字号Ctrl + -
显示快捷键?