Author Topic: Question of the day #6  (Read 1800 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Question of the day #6
« on: December 02, 2004, 08:58:33 AM »
How might you use the strcase function for user input?


Question of the day guidelines:
1. Please do not post your answer for 24 hours after the time of the post.
2. If you wish, you may post something like "I've got it!"
3. Feel free to ask questions, or for hints.
4. Feel free to PM the person who asked the question.
5. Do not be embarrassed by your answer or code.
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Question of the day #6
« Reply #1 on: December 03, 2004, 12:40:07 PM »
I thought this was an easy one, guess not.

answer
Code: [Select]

(defun c:cont (/ ans)
(setq ans (strcase (getstring "\nContinue[Y/N]<Yes>: ")))

(cond ((or (= ans "")(= ans "Y"))
  (princ "\nOk we'll continue"))
 ((= ans "N")
  (princ "\nWe will stop now"))
 )
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)