[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Understanding the "let" construct and the setting of variables
From: |
steve-humphreys |
Subject: |
Understanding the "let" construct and the setting of variables |
Date: |
Thu, 17 Dec 2020 01:10:06 +0100 |
I have been writing some elisp to set the time grid in the agenda.
The discussion progressed towards the use of the "let" construct.
But, the discussion got too advanced for me to follow the different
points of view and make a decision.
This message is for showing some examples, of how to set and use variables
in a "let", because people criticise using "setq". But discussion needs
simple examples that would not overwhelm a relative beginner.
(defun timfutur ()
(interactive)
(setq tim 845)
(setq tsk 80)
(setq thr (/ tim 100))
(setq tmn (- tim (* thr 100)))
(setq tinc_mn (+ tmn tsk))
(setq tinc_hr (/ (+ tmn tsk) 60))
(setq tinc_mn (- tinc_mn (* tinc_hr 60)) )
(setq thr_futur (* (+ thr tinc_hr) 100) )
(setq tmn_futur tinc_mn)
(setq tim_out (+ thr_futur tmn_futur))