Correct Input

Notices and updates
Locked
scottmaccal
Posts: 20
Joined: Fri Mar 28, 2008 2:12 am

Correct Input

Post by scottmaccal »

Hi all,

I'm trying to verify correct input. I want to make sure that the user either inputs yes or no before the program continues. How would this best be accomplished? So far I this code fragment:

Code: Select all

(print "yes or no") 

(set 'answer (read-line))

# WAS THE ANSWER YES OR NO?

(if (= answer "yes")
  (print "yes "))

(if (= answer "no")
  (print "no"))
Whether gods exist or not, there is no way to get absolute certainty about ethics. Without absolute certainty, what do we do? We do the best we can. --Richard Stallman

scottmaccal
Posts: 20
Joined: Fri Mar 28, 2008 2:12 am

Never mind

Post by scottmaccal »

Hi all,

Never mind. Solution found. I must have taken stupid pills this morning.
Whether gods exist or not, there is no way to get absolute certainty about ethics. Without absolute certainty, what do we do? We do the best we can. --Richard Stallman

Locked