6. Add Comments to a Script

You can add comments to your script to remind yourself or others of how your code works. Comments are ignored when your script is executed.

The apostrophe symbol ( ' ) is used to indicate that the text from the apostrophe to the end of the line is a comment.

Add a:

Full line comment

End of line comment.

Full line comment

  1. Type an apostrophe ( ' ) at the start of the line.

  2. Type a comment following the apostrophe.

Result: When the script is run, the presence of the apostrophe at the start of the line will cause the entire line to be ignored.

End of line comment

  1. Position the insertion point in the empty space beyond the end of the line of code.

  2. Type an apostrophe ( ' ).

  3. Type a comment following the apostrophe.

Result: When the script is run, the code on the first portion of the line will be executed, but the presence of the apostrophe at the start of the comment will cause the remainder of the line to be ignored.

Note: Although you can place a comment at the end of a line containing executable code, you cannot place executable code at the end of a line containing a comment; the presence of the apostrophe at the start of the comment will cause the balance of the line (including the code) to be ignored.

More information

Edit programs.