TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: rude dog on February 04, 2004, 02:59:25 PM

Title: 'STR
Post by: rude dog on February 04, 2004, 02:59:25 PM
What is the 'STR in the statement below?.... I tried changing it to 'ABC (thinking I would get the same results) and the prompt came up as "NO ITS NOT"
but when I run it with the 'STR in the expression.... prompt reads  
"YES ITS A STRING"

(defun C:STT ()
  (setq TEST "THIS IS A STRING")
  (if (= (type TEST) 'STR)
    (prompt "YES ITS A STRING")
    (prompt "NO ITS NOT")
  )
  (princ)
)
Title: 'STR
Post by: daron on February 04, 2004, 03:01:59 PM
Test (type TEST). What is the result? In your case it is STR. Look at the help file for type. You should find your answer.
Title: 'STR
Post by: Keith™ on February 04, 2004, 03:08:51 PM
In AutoLISP every variable is assigned a type according to what is in the variable, for example, if you type:
Code: [Select]
(setq A "a")
The type of variable A is, is a STRing

Code: [Select]
(setq A 1)
The type of variable A is, is an INTeger

Code: [Select]
(setq A 1.0)
The type of variable A is, is a REAL (aka long)

Code: [Select]
(setq A '(0 1 2)
The type of variable A is, is a LIST

If you have a function and you check it, the value will be:
Code: [Select]
(setq A C:MYFUNCTION)
The type of variable A is, is an SUBRoutine

Do you get the idea?
Title: 'STR
Post by: rude dog on February 04, 2004, 04:20:26 PM
good enuf thanks :wink:
Title: 'STR
Post by: Keith™ on February 04, 2004, 04:21:28 PM
No problem....