[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function that changes value of a variable
From: |
wilnerthomas |
Subject: |
Function that changes value of a variable |
Date: |
Sun, 21 Aug 2022 02:54:52 +0200 (CEST) |
I am trying to change the value a a variable with the following function, but
is not working as intended.
(defun constrain (var min-n max-n) "Ensure that value of var is between MIN-N
and MAX-N inclusive by constraining." (cond ((< var min-n) (setq var
min-n)) ((> var max-n) (setq var max-n)) ((eq var t) (setq var 1))
((eq var nil) (setq var 0))))
Have done the following test, but the value stays 21.
(defvar pingu 21)
(constrain pingu 0 8)
(message "%d" pingu)
- Function that changes value of a variable,
wilnerthomas <=