The special forms defvar and defconst allow you to define
the global variables which will be used in a program. This is entirely
optional; it is highly recommended though.
If the doc-string argument is defined it is a string documenting
variable. This string is then stored as the symbol's
variable-documentation property and can be accessed by the
describe-variable function.
(defvar my-variable '(x y)
"This variable is an example showing the usage of the defvar
special form.")
=> my-variable
defconst defines a constant, the symbol constant. Its value
(in the case of a buffer-local symbol, its default value) is set to the
result of evaluating form. Note that unlike defvar the value
of the symbol is always set, even if it already has a value.
The doc-string argument, if defined, is the documentation string for the constant.
(defconst the-answer 42
"An example constant.")
=> the-answer
See section Constant Variables.
Go to the first, previous, next, last section, table of contents.