Lesson 5 of my Beginner AutoLISP Tutorials introduces the all important "SETQ". And we encounter our first AutoLISP problem solving challenge.
I highly recommend reading an online tutorial on the differences between "SETQ" and "SET" at some point (this confuses a lot of programmers).
I've included the finished Lesson 4 Code Below:
;-----------------------------------------------------------------------------------------------------------------------
(defun C:VP (/)
(if (= (tblsearch "LAYER" "VIEWPORT") nil)
(command "-layer" "M" "VIEWPORT" "C" 177 "" "LT" "PHANTOM2" "" "P" "N" "" "")
); end if
(setvar "CLAYER" "VIEWPORT")
(command "MVIEW")
); end defun