Next: Constant Variables Prev: Variables Up: Variables
The simplest way to use a variable is "globally". This means that
the variable has just one value at a time, and this value is in effect
(at least for the moment) throughout the Lisp system. The value remains
in effect until you specify a new one. When a new value replaces the
old one, no trace of the old value remains in the variable.
You specify a value for a symbol with `setq'. For example,
(setq x '(a b))
gives the variable `x' the value `(a b)'. Note that the first argument
of `setq', the name of the variable, is not evaluated, but the second
argument, the desired value, is evaluated normally.
Once the variable has a value, you can refer to it by using the
symbol by itself as an expression. Thus,
=> (a b)
assuming the `setq' form shown above has already been executed.
If you do another `setq', the new value replaces the old one:
=> (a b)
(setq x 4)
automatically generated by info2www