Jump to content

Recommended Posts

Posted

When should I use (princ ) or (prompt ) ????

Posted

use Prompt when sharing the code with noobs. and princ when they now that there is no difference.

Posted

Actually (prompt) always returns nil (princ) only returns nil when called less a 'STR parameter.

(and (setq a (+ 1 1))
    (princ "\nI Want To Continue)
    (setq b (+ a 1))
    (prompt "\nI'm Stopping Now)
    (setq c (+ b 1))
    (princ))

 

With the 1st (princ) call, b is bound to (+ 1 a). Because of the (prompt) call, c is not bound to a value. With the last (princ) call, the function would return nil and exit cleanly. -David

Posted

prompt
(prompt msg)
On dual-screen AutoCAD configurations, prompt displays msg on both
screens and is, therefore, preferable to princ.

I generally use princ since it won't interrupt and and statement.

 

Here's another reason:

Command: (prompt (list "A" "B" "D"))

Error: bad argument type: stringp ("A" "B" "D")
Command: (princ (list "A" "B" "D"))
(A B D)("A" "B" "D")

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...