Example
Let us write a simple macro named setTo10, which will take a number and set its value to 10.
Create new source code file named main.lisp and type the following code in it.
(defmacro setTo10(num)
(setq num 10)(print num))
(setq x 25)
(print x)
(setTo10 x)
When you click the Execute button, or type Ctrl+E, LISP executes it immediately and the result returned is:
25
10
LISP - Variables
In LISP, each variable is represented by a symbol. The variable's name is the name of the symbol and it is stored in the storage cell of the symbol.
Global Variables
Global variables have permanent values throughout the LISP system and remain in effect until a new value is specified.
Global variables are generally declared using the defvar construct.
For example
(defvar x 234)
(write x)