Hi there,
I'm total new to Autolisp. I'm trying to familar with it by programming some simple statements.
I'm in trouble with the below program when I used princ function. Please take a look at my program.
(defun c:sum()
(setq a (getint "Number1: "))
(setq b (getint "Number2: "))
(setq sum (+ a b))
(princ sum)(princ)
)
When I enter values of Number 1 and Number 2 are 10 and 30, the result displaying in AutoCAD command is 3030 instead of 30.
I've have been searching but nothing can work in my situation.
Could anyone help me with this?
Thank you.
Khanh
Solved! Go to Solution.
Solved by hgasty1001. Go to Solution.
Hi,
I can't reproduce the problem and that's the way it should be, as the last princ returns a null symbol that it's not printed to the command line, lisp always returns the last evaluated variable or expression in a function, in this case the last evaluated expression is (princ). So look again the code, as you may be missing the last (princ) in your executing code.
Gaston Nunez