AutoLISP Variables

AutoCAD AutoLISP & Visual LISP

 
AutoLISP Variables
 
 
 

An AutoLISP variable assumes the data type of the value assigned to it. Until they are assigned new values, variables retain their original values. You use the AutoLISP setq function to assign values to variables.

(setq variable_name1 value1
[variable_name2 value2 ...])

The setq function assigns the specified value to the variable name given. It returns the value as its function result. If you issue setq at the Visual LISP Console prompt, the result is displayed in the Console window:

_$ (setq val 3
abc 3.875)
3.875 
_$ (setq layr "EXTERIOR-WALLS")
"EXTERIOR-WALLS" 
_$