That can be handled in several ways depending on the kind of value involved, whether or not you want to offer a particular default value if the User has not yet specified one, and if not to prevent Enter on first use, whether you want to offer a limited selection of options or accept any appropriate input, and for a numerical value whether it is allowed to be zero and/or negative.
When I want to offer a specific value as a first default, I don't usually set that in ahead of time if there's no User value yet, but build it right into the (get...) function. Here's one to set a Fillet radius [allowed to be zero, but not negative] for a special-purpose command, offering as the default the previous setting if there is one, but if not, the current radius setting for regular Fillet:
(initget 4); no negative
(setq *fmpr* ; global variable
(cond
( (getdist ; [returns nil on Enter]
(strcat
"\nRadius for Filleting all Polyline corners <"
(rtos (cond (*fmpr*) ((getvar 'filletrad))))
; offer prior value as default if present; if not, regular Fillet radius
">: "
); strcat
); getdist
); User-input condition
(*fmpr*); prior value if present on Enter
((getvar 'filletrad)); regular Fillet radius if no prior value on Enter
); cond
); setq
Here's one for a displacement-type distance, which in this particular command is allowed to be negative, but not zero, and with no particular value appropriate to offer as default on first use, so not permitting Enter unless there is a value:
(initget (if *RSAdelta* 2 3)); no zero, no Enter on first use
(setq *RSAdelta* ; global variable for subsequent-use default
(cond
( (getdist
(strcat
"\nEdge length change {positive or negative}"
(if *RSAdelta* (strcat " <" (rtos *RSAdelta*) ">") "")
; offer prior value as default if present, otherwise no default
": "
); strcat
); getdist
); User-input condition
(*RSAdelta*); prior value if present
); cond & *RSAdelta*
); setq
There are many other possibilities. For example, text-string variables such as Layer or Block names need to be handled differently because (getstring) does not return nil on Enter, as (getint) and (getreal) and (getdist) and (getangle) do, but a text string that "exists" but contains no characters [""]. With specific option possibilities, (getkword) is a better approach than (getstring).
In your particular example, I would do it this way:
(initget (if inp 6 7)); no zero, no negative, no Enter unless there's a prior value
(setq inp
(cond
( (getreal ; returns nil on Enter [when permitted]
(strcat
"\nEnter a real number"
(if inp (strcat " <" (rtos inp) ">") "")
;; offer default if prior value, otherwise add nothing
": " ; end of prompt
); strcat
); getreal
); end User-input condition
(inp); prior value on Enter [when permitted]
); cond
); setq
If you hit Enter on first use when there's no prior value set yet, it will keep asking again until you give it a number.
[That (rtos inp) will display the prior value in whatever the current units mode and precision settings are, but can be made more particular.]
Kent Cooper, AIA