The AutoCAD Sample\VisualLISP directory contains a file named drawline-with-errors.lsp. It is similar to the drawline.lsp program file introduced earlier in this manual, but it contains a couple of errors. Open the file in VLISP, so that you can see how color is used in the file:
(defun drawline(/ pt1 pt2) ; Local variables declared
;; get two points from the user
(setq pt1 (getpoint "\nEnter the start point for the line: "))
(setq pt2 (getpoint pt1 "\nEnter the end point for the line: "))
;; check to see that the two points exist
(iff (and pt1 pt2)
(command "_.line" pt1 pt2 "")
(princ "\nInvalid or missing points!")
(princ) ;; exit quietly
)
)
If you use the standard VLISP syntactic colorations, systems functions such as setq, defun, getdist, getpoint, and / are displayed in blue. The items VLISP does not recognize, such as user-defined variables, are printed in black. In this example, if you look at the unrecognized elements in the program, the word iff might easily catch your eye. Change it to the correct spelling, if, and the color immediately changes to blue.