Comments are notes that the programmer places in the script to remind him/her of something or to assist someone who is reading the script or program. The compiler sees the comment indicators and does not compile the comment. They are considered essential in good programming practice. They can be sort of a diary not only for yourself, but anyone who may need to build on your code.
Single Line CommentsEdit
Set off by double hyphens at the beginning of the comment. This type of comment can only be on one line. You will receive a compiler error if the comment is on multiple lines. This is because the compiler compiles the parts of the comment that are not on the first line of the comment. Your comment most likely does not contain actual code.
--Your single line comment here
Alternative Single Line CommentsEdit
Starting in AppleScript 2.0, support for comments using "#" was added.
#Here is an alternate comment, as long as you have updated AppleScript to 2.0 or later
This has various uses such as turning a script into a Unix executable. This can be done by adding:
to the beginning of a script
Set off by (* and ended with *). This type of comment creates a "block" of text that the compiler ignores i.e. a comment that can extend for a few lines.
(* Your single line comment here. *)
(* First line... Second line... and so on... *)
Like with other commands in AppleScript—If-then-else, for example—you can nest comments within each other
(* Here are some --nested comments (* another comment within a comment *) *)