It is good practice to include comments in AutoLISP program files. Comments are useful to both the programmer and future users who may need to revise a program to suit their needs. Use comments to do the following:
- Give a title, authorship, and creation date
- Provide instructions on using a routine
- Make explanatory notes throughout the body of a routine
- Make notes to yourself during debugging
Comments begin with one or more semicolons (;) and continue through the end of the line.
; This entire line is a comment
(setq area (* pi r r)) ; Compute area of circle
Any text within ;| ... |; is ignored. Therefore, comments can be included within a line of code or extend for multiple lines. This type of comment is known as an in-line comment.
(setq tmode ;|some note here|; (getvar "tilemode"))
The following example shows a comment that continues for multiple lines:
(setvar "orthomode" 1) ;|comment starts here
and continues to this line,
but ends way down here|; (princ "\nORTHOMODE set On.")
It is recommended that you use comments liberally when writing AutoLISP programs. The tutorial files provided with VLISP contain good examples of commenting style. If you've installed the AutoLISP Tutorial files, you'll find the AutoLISP tutorial code in the Tutorial\VisualLISP directory.