PDA

View Full Version : Alert message does not display in while statement



Adesu
2006-09-21, 06:23 AM
Hi Alls,
I have a simple code to check if a variable same as a target,then alert message would display,I just repeat test it,but always fail,any am I wrong?


(defun c:test (/ sdia hei)
(setq sdia 25)
(setq hei 21)
(while
(if
(= hei (* sdia 0.8))
(alert "\nTarget has finish")
) ; if
(setq hei (- hei 0.1))
) ; while
) ; defun

ElpanovEvgeniy
2006-09-21, 06:43 AM
(defun c:test (/ sdia hei)
(setq sdia 25)
(setq hei 21)
(while (if (equal hei (* sdia 0.8) 0.01)
(alert "\nTarget has finish")
(setq hei (- hei 0.1))
) ; if
) ; while
)

CAB2k
2006-09-21, 08:09 PM
(defun c:test (/ sdia hei)
(setq sdia 25)
(setq hei 21)
(while (> hei (* sdia 0.8))
(setq hei (- hei 0.1))
)
(alert "\nTarget has finish")
)

Adesu
2006-09-22, 12:03 AM
Hi elpanov,
It's great,many thanks for you.




(defun c:test (/ sdia hei)
(setq sdia 25)
(setq hei 21)
(while (if (equal hei (* sdia 0.8) 0.01)
(alert "\nTarget has finish")
(setq hei (- hei 0.1))
) ; if
) ; while
)