-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Line 217 in 2b7f550
| R and Python use the hash sign `\#` to create these comments. The comment will always begin after the hash. If the first character in your line is a `\#` all the text included will be considered as a comment; but if you have already written some code in a line and include a `\#` after the code, the initial code will be executed and you will always see the comment by its side. You will normally combine these two ways of documenting your script. |
This line got rendered into (or in the book)
R and Python use the hash sign <code>\#</code> to create these comments. The comment will always begin after the hash. If the first character in your line is a <code>\#</code> all the text included will be considered as a comment; but if you have already written some code in a line and include a <code>\#</code> after the code, the initial code will be executed and you will always see the comment by its side. You will normally combine these two ways of documenting your script. As a rule of thumb, insert a comment if the code itself is not obvious, and explain the choices and intentions of the code. So, if a line says <code>df = df - 1</code>, a comment like <em>Decrease df by one</em> is not very useful (as that is obvious from the code), but a comment like <em>Remove one degree of freedom since we estimated the mean</em> does help, as it makes it clear why we are subtracting one from the <code>df</code> object.If I have no clue, I might write comments with "\#". I think the escaping is not required if it's already in backticks (see this).
Metadata
Metadata
Assignees
Labels
No labels