Comments

As you write scripts, a best practice is to leave yourself or others little notes on what you are doing and why. These are called comments. The script does not read comments, the script editor grays out all comments so they are easily differentiated from the script. They are extremely helpful when trying to make sense of a script that you wrote last week, or 3 years ago. They also help others who are using and trying to modify your script, or someone who is trying to help you when a part of your script isn’t working.

Another way to use them is to comment out a line of code which isn’t working to try a new line of code. It is nice to save code that you may need to come back to instead of deleting it.

I also use comments to make notes on what I want to do next in the script, especially if I’ve worked out how I want to accomplish a task but it’s time to go home for the weekend.

To comment out a single line use two dashes: —
To comment out paragraphs of text use (* at the beginning and *) at the end. If you check out my starter scripts, you will see examples of comments.

Add your comment

Your email address will not be published. Required fields are marked *