Message 1 of 22
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all!
I want to make it so that when I ask for user input in a while iteration, if the value is the same as the last time, all I have to do is press Enter.
So, I came up with the following code.
However, I'm wondering if I can make it a bit smarter and more Lisp-like.
Please give me some advice.
(defun c:test1 (/ inp temp)
(while (and
(if (not inp)
(progn
(initget 7)
(setq inp (getreal "\nEnter a real number :"))
)
(progn
(initget 6)
(setq temp inp)
(prompt "\nEnter a real number <")
(princ inp)
(setq inp (getreal "> :"))
(if (not inp)
(setq inp temp)
(setq inp inp)
)
)
)
(princ "\nInput Data = ")
(princ inp)
(princ)
))
)
Saitoib
Solved! Go to Solution.