Jump to content

Recommended Posts

Posted

Hi All again,

 

It is seriously weird! I used to programming with BASIC, it was much more sensible!

 

Anyway, another strange thing:

 

(defun c:prac2 (/ a)

(setq a Y)

(prompt "\nThanks")

 

)

 

and I get:

 

Command: PRAC2

Thanksnil

what is "nil" for?

 

Please help me before I give up :wink:

 

Thanks in advance

 

Ali

Posted

Same issue as in your other post:

 

(defun c:prac2 ( / a)
(setq a Y)
(prompt "\nThanks")
(princ)
)

 

Also take care that the Y variable may not bear a value (global variable), so a will be set to nil (it is already nil since is a local variable and wasn't assigned before).

 

Regards,

Posted
Same issue as in your other post:

 

(defun c:prac2 ( / a)
(setq a Y)
(prompt "\nThanks")
(princ)
)

Also take care that the Y variable may not bear a value (global variable), so a will be set to nil (it is already nil since is a local variable and wasn't assigned before).

 

Regards,

 

Thanks mate I got it!

 

now I have another question:

 

I wrote:

(defun c:prac2 (/ a)

(setq a "Y")

(prompt "\nThanks")

(prompt a)

(princ)

)

 

and I get:

 

Command: PRAC2

ThanksY

 

How can I drop Y in the next line?

 

 

Thanks

Posted

All stings are returned on prompter, on the same line – try to switch to a new line to get it separated:

 

(defun c:prac2( / a)
(setq a "Y")

(prompt "\nThanks")
(prompt "\n")
(prompt a)

(princ)    
)

or

(defun c:prac2( / a)
(setq a "Y")

(prompt "\nThanks")
(prompt (strcat "\n" a))

(princ)    
)

 

Regards,

Posted
(defun c:prac2( / a)
(setq a "Y") 
(prompt "\nThanks[color="Red"]\n[/color]")
(prompt a)
(princ)    
)

Posted

(defun c:prac2( / a)
(setq a "Y") 
(write-line "Thanks")
(write-line a)
(princ)
  
)

 

Just an alternative methoid. Prin1,princ,print would probably be the more typical choice though

Posted

Thanks guys really appreciate it.

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...