Copyright (C) 2000-2012 |
GNU Info (librep.info)Defining VariablesDefining Variables ------------------ The special forms `define', `defvar' and `defconst' allow you to define the global variables that will be used by a program. - Macro: define variable form Defines a lexically scoped global variable called VARIABLE. It will have the result of evaluating FORM assigned to it. Note that the `define' special form may also be used to declare block-structured functions, Note: Definitions. - Special Form: defvar variable [form [doc-string]] This special form defines a special (i.e. dynamically scoped) variable, the symbol VARIABLE. If the value of VARIABLE is void the FORM is evaluated and its value is stored as the value of VARIABLE (note that only the default value is modified, never a buffer-local value). If no FORM is given the assigned value defaults to false. 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* - Macro: defconst constant form [doc-string] `defconst' defines a global constant, the symbol CONSTANT. Its 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 automatically generated by info2www version 1.2.2.9 |