From: Simeon Willbanks Date: 2009-12-19T10:39:07+09:00 Subject: Re: simple one I've written a simple program which I believe meets your requirements. I've changed the text a bit, but I hope the code is helpful. Simeon class Choice def initialize @choices = ['y', 'N'] @instructions = 'make a choice '+ @choices.join('/') @response = 'you have choosen %s'+"\n"+'Goodbye' end def ask() puts @instructions STDOUT.flush @input = gets.chomp self.respond() end def respond() if @choices.include?(@input) puts @response % @input STDOUT.flush else self.ask() end end end c = Choice.new c.ask() -- Posted via http://www.ruby-forum.com/.