I am trying to create a list in the command prompt by entering a group of numbers.
What I have done is shown below. Can you help to group these numbers as a list?
In my case the numbers would be: 1st, 2nd, 3rd, 4th, 5th, and so on
BTW obviously I will amend the code to show correctly when the numbers entered are more than 20th (i.e. 21st, 22nd, 23rd
), but I am not worried at this time.
Your helps are much appreciated.
(setq ElementInitial 1)
(while (/= ElementInitial nil)
(if (= ElementInitial 1) (setq ListElementName "1st"))
(if (= ElementInitial 2) (setq ListElementName "2nd"))
(if (= ElementInitial 3) (setq ListElementName "3rd"))
(if (> ElementInitial 3) (setq ListElementName (strcat (itoa ElementInitial) "th"))
(setq ElementInitial (+ ElementInitial 1))
(setq ListElement (getreal (strcat "\nEnter the " ListElementName " number: ")))
); end of while