⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m2_for.hlp

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 HLP
字号:
{smcl}
{* 28mar2005}{...}
{cmd:help m2 for}
{hline}
{* index for tt}{...}

{title:Title}

{p 4 4 2}
{bf:[M-2] for -- for (exp1; exp2; exp3) stmt}


{title:Syntax}

	{cmd:for (}{it:exp1}{cmd:;} {it:exp2}{cmd:;} {it:exp3}{cmd:)} {it:stmt}


	{cmd:for (}{it:exp1}{cmd:;} {it:exp2}{cmd:;} {it:exp3}{cmd:) {c -(}}
		{it:stmts}
	{cmd:{c )-}}


{p 4 4 2}
where {it:exp1} and {it:exp3} are optional, and 
{it:exp2} must evaluate to a real scalar.


{title:Description}

{p 4 4 2}
{cmd:for} is equivalent to

	{it:exp1}
	{cmd:while (}{it:exp2}{cmd:)} {cmd:{c -(}}
		{it:stmt(s)}
		{it:exp3}
	{cmd:{c )-}}

{p 4 4 2}
{it:stmt(s)} is executed zero or more times.  The loop continues as long as
{it:exp2} is not equal to zero.


{title:Remarks}


{p 4 4 2}
To understand {cmd:for}, enter the following program

	{cmd}function example(n)
	{
		for (i=1; i<=n; i++) {
			printf("i=%g\n", i)
		}
		printf("done\n")
	}{txt}

{p 4 4 2}
and run {cmd:example(3)}, {cmd:example(2)}, {cmd:example(1)}, 
{cmd:example(0)}, and {cmd:example(-1)}.

{p 4 4 2}
Common uses of {cmd:for} include

	{cmd:for (i=1; i<=rows(A); i++) {c -(}}
		{cmd:for (j=1; j<=cols(A); j++) {c -(}}
			...
		{cmd:{c )-}}
	{cmd:{c )-}}


{title:Also see}

{p 4 13 2}
Manual:  {hi:[M-2] for}

{p 4 13 2}
Online:  help for 
{bf:{help m2_semicolons:[M-2] semicolons}},
{bf:{help m2_while:[M-2] do}},
{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 + -