Comments are text added in your scripts that are ignored when the script is run, but may be used to explain aspects of the code. In a script node, you can add comments in two ways:
//is used to mark the rest of the line as a comment:
//This is a comment on one line.
/*are placed in front and*/after a comment that runs over several lines.
/* This is a comment on
two lines */
Multi-line comments cannot be nested, because everything after /* will be interpreted as comments, and when the first */ appears, it will be interpreted as the end of the comment. So any text following the first */ will be treated as code:
/* This is an example of a
nested comment.
/* Here is the second comment, inside the first.
Both of these comments will terminate here ->*/
This line will be treated as code and result in errors. */
It is recommended that you add a lot of comments in your scripts, to explain to yourself and to others what your script is supposed to do and what it can be used for. However, as you may later want to comment out large parts of your scripts, including comments, and it is not possible to nest comments, it is recommended that you always use the single line comments, as shown below:
// This is a comment on
// two lines
This will make it easy to use /* and */ to comment out large sections of the script later without the nesting problems.