In AutoLISP, Yes/No is T/nil
T: True Yes, Meets the requirements…etc.
nil: False, No, Wrong, Does not meet the Requirement, Empty
Preparation
T/nil
A Return is a reply from AutoCAD when you use AutoLISP.
If we ask AutoCAD “What is the current layer?” there are many possible replies.
However, there are questions which have only Yes or No answers.
Such as…
- Does this Variable Symbol have some value?
- Is it a number?
- Does this Variable have the same value?
- Is this number bigger than 10?
For these questions, the Return Value will be only T or nil.
- T True Yes, Meets the Requirements…etc
- nil False, No, Wrong, Does not Meet the Requirement…etc
For Example
(setq x 10)
With this code, number 10 is attached to symbol x
(= x 10)
Are X and 10 the same?
T
(numberp x)
Is X a number?
T
(< x 5)
Is X smaller than 5?
nil
Like these example, AutoCAD returns T when the answer is Yes, and it returns nil when the answer is No.
nil -Empty-
Also, nil can mean empty.
AutoCAD returns nil when we ask to get some value or a symbol which is empty.
If you want to know what value is attached to a symbol, you can use ! to check it
!Variable_Name
!x
10
!y
nil
To Sum Up
- Return Value T means True Yes, Meets the requirements…etc.
- Return Value nil means False, No, Wrong, Does Not Meet the Requirement…etc.
- nil can be mean Empty as well.
Comments