From: Dark Ambient Date: 2006-06-25T22:59:15+09:00 Subject: Re: Stumped:beginners question I tried this option first: if (reply != 'yes' && reply != 'no') Which now if response is anything but those two answers brings up the "please answer yes or no..." However, I've added the return reply , and if response is anything but yes or no, it notifies responder but still moves on to the next question. The case statement is preferable but it hasn't been introduced yet to my learning material. def ask question reply = nil while (not reply) puts question reply = gets.chomp.downcase if (reply !='yes' && reply != 'no' ) puts ' Please answer "yes" or "no".' elsif reply == 'yes' reply = true else reply == 'no' reply = false return reply end end end On 6/25/06, Rob Biedenharn wrote: > On Jun 25, 2006, at 9:32 AM, Dark Ambient wrote: > > > if (reply !='yes' || reply != 'no' ) > > puts ' Please answer "yes" or "no".' > > > > > > elsif reply == 'yes' > > reply = true > > else reply == 'no' > > reply = false > > end > > Try: > if (reply != 'yes' && reply != 'no') > > OR: > > case reply > when 'yes': reply = true > when 'no' : reply = false > else puts 'please answer "yes" or "no"' > end > > In your original, reply is going to be != to at least one of the two > alternatives! > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob@AgileConsultingLLC.com > +1 513-295-4739 > > > > > >