I was hoping to get feedback in understanding Stata comments. The documentation was helpful but I wonder if I'm missing anything:
- Multi-line comments can be nested. This means that every "/*" within a multi-line comment must be closed.
- Stata ignores everything within "/*" and "*/" across lines unless the first "/*" appears in a line that starts with "//" or after " //".
- Stata ignores everything after in-line comments: "//" at the start of a line or after " //" at the end of a line (given they is not preceded by "/*").
- Stata ignores code after "*" at the start of a line or "*" directly after a multi-line comment. However, line continuations (" ///"), multi-line comments ("/*" to "*/"), and in-line comment rules (" //") apply after a "*".
If you run the following:
(Note that if "*/*" was replaced with "*///" we would get an error). If I am missing something in terms of comment hierarchy, I would be really thankful for input. Cheers!
- Multi-line comments can be nested. This means that every "/*" within a multi-line comment must be closed.
- Stata ignores everything within "/*" and "*/" across lines unless the first "/*" appears in a line that starts with "//" or after " //".
- Stata ignores everything after in-line comments: "//" at the start of a line or after " //" at the end of a line (given they is not preceded by "/*").
- Stata ignores code after "*" at the start of a line or "*" directly after a multi-line comment. However, line continuations (" ///"), multi-line comments ("/*" to "*/"), and in-line comment rules (" //") apply after a "*".
If you run the following:
Code:
* /* This will be a multi-line comment disp "Not printed" */ * // /* Ignored due to inline comment disp "Printed 1" // /* Also ignored due to inline comment disp "Printed 2" *// /* This is not an inline comment, so this is multi-line again disp "Not printed" */ * /// disp "Not printed. Line continuation applies" // /// Line continuation ignored due to inline comment disp "Printed 3" /* /* Nested */ disp "Not printed" */* disp "Not printed"
Comment