Input Options for User-Input Functions
 
 
 

The value of the bits argument restricts the types of user input to the next user-input function call. This reduces error-checking. These are some of the available bit values: 1 disallows null input, 2 disallows input of 0 (zero), and 4 disallows negative input. If these values are used with a following call to the getint function, the user is forced to enter an integer value greater than 0.

To set more than one condition at a time, add the values together (in any combination) to create a bits value between 0 and 255. If bits is not included or is set to 0, none of the control conditions applies to the next user-input function call. (For a complete listing of initget bit settings, see initget in the AutoLISP Reference.)

(initget (+ 1 2 4))
(getint "\nHow old are you? ")

This sequence requests the user's age. AutoCAD displays an error message and repeats the prompt if the user attempts to enter a negative or zero value, or if the user only presses ENTER, or enters a string (the getint function rejects attempts to enter a value that is not an integer).