GNU Info

Info Node: (emacs-lisp-intro.info)let

(emacs-lisp-intro.info)let


Next: if Prev: Permanent Installation Up: Writing Defuns
Enter node , (file) or (file)node

`let'
=====

   The `let' expression is a special form in Lisp that you will need to
use in most function definitions.

   `let' is used to attach or bind a symbol to a value in such a way
that the Lisp interpreter will not confuse the variable with a variable
of the same name that is not part of the function.

   To understand why the `let' special form is necessary, consider the
situation in which you own a home that you generally refer to as `the
house', as in the sentence, "The house needs painting."  If you are
visiting a friend and your host refers to `the house', he is likely to
be referring to _his_ house, not yours, that is, to a different house.

   If your friend is referring to his house and you think he is
referring to your house, you may be in for some confusion.  The same
thing could happen in Lisp if a variable that is used inside of one
function has the same name as a variable that is used inside of another
function, and the two are not intended to refer to the same value.  The
`let' special form prevents this kind of confusion.

Prevent confusion
Parts of let Expression
Sample let Expression
Uninitialized let Variables

automatically generated by info2www version 1.2.2.9