help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Understanding the "let" construct and the setting of variables


From: Joost Kremers
Subject: Re: Understanding the "let" construct and the setting of variables
Date: Thu, 17 Dec 2020 08:58:39 +0100
User-agent: mu4e 1.5.7; emacs 27.1.50

On Thu, Dec 17 2020, steve-humphreys@gmx.com wrote:
> I ran the following  
>
> ELISP> tima
> (lett 845 80)
> "tim_out: 1005"
>
> ELISP> tim
> *** Eval error ***  Symbol’s value as variable is void: tim
>
> ELISP> (lett 845 90)
> "tim_out: 1015"
>
> ELISP> tim
> *** Eval error ***  Symbol’s value as variable is void: tim
>
> So this is quite different from using "setq".  The variable "tim" is
> not available to all of emacs.

Yes, indeed. Variables bound with `let` or `let*` only exist inside the `let`.
So as soon as you put the closing parenthesis matching the opening parenthesis
directly before the `let`, the variables go out of scope and no longer exist.
(There are actually a couple of subtleties involved that make this statement
less than universally true, but those issues shouldn't concern a beginner.)



-- 
Joost Kremers
Life has its moments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]