📄 m2_comments.hlp
字号:
{smcl}
{* *! version 1.0.0 24may2005}{...}
{cmd:help m2 comments}
{hline}
{* index comments}{...}
{title:Title}
{p 4 4 2}
{hi:[M-2] comments -- Comments}
{title:Syntax}
{cmd:/*} {it:enclosed comment} {cmd:*/}
{cmd://} {it:rest-of-line comment}
{p 4 4 2}
Notes:
{p 8 12 2}
1.
Comments may appear in do-files and ado-files; they are not allowed
interactively.
{p 8 12 2}
2.
Stata's beginning-of-the-line asterisk comment is not allowed in Mata:
. {cmd:*} {it:valid in Stata but not in Mata}
{title:Description}
{p 4 4 2}
{cmd:/*} and {cmd:*/} and {cmd://} are how you place comments in
Mata programs.
{title:Remarks}
{p 4 4 2}
There are two comment styles: {cmd:/*} and {cmd:*/}, and {cmd://}.
You may use one, the other, or both.
{p 4 4 2}
Remarks are presented under the headings
{bf:The /* */ enclosed comment}
{bf:The // rest-of-line comment}
{title:The /* */ enclosed comment}
{p 4 4 2}
Enclosed comments may appear on a line:
{cmd:/*} {it:What follows uses an approximation formula:} {cmd:*/}
{p 4 4 2}
Enclosed comments may appear within a line and even in the middle of a
Mata expression:
{cmd:x = x + /*}{it:left-single quote}{cmd:*/ char(96)}
{p 4 4 2}
Enclosed comments may themselves contain multiple lines
{cmd:/*}
{it:We use the approximation based on sin(x) approximately}
{it:equaling x for small x; x measure in radians}
{cmd:*/}
{p 4 4 2}
Enclosed comments may be nested, which is useful for commenting out code that
itself contains comments:
{cmd:/*}
{it:for (i=1; i<=rows(x); i++) {c -(}} {cmd:/*} {it:normalization} {cmd:*/}
{it:x[i] = x[i] :/ value[i]}
{it:{c )-}}
{cmd:*/}
{title:The // rest-of-line comment}
{p 4 4 2}
The rest-of-line comment may appear by itself on a line
{cmd://} {it:What follows uses an approximation formula:}
{p 4 4 2}
or it may appear at the end of a line:
{cmd:x = x + char(96) //} {it:append single quote}
{p 4 4 2}
In either case, the comment concludes when the line ends.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-2] comments} (forthcoming)
{p 4 13 2}
Online: help for
{bf:{help m2_intro:[M-2] intro}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -