From: hazal Ates Date: 2010-07-27T15:47:41+09:00 Subject: Re: stop program with entering a key... Michael Jackson wrote: > The following code doesn't do exactly what you need, but it should be > enough to get you started in the right direction. > > def prompt > STDOUT.write ">> " > gets > end > > def game_over > puts "thank you.\ngame over!" > exit > end > > trap ("INT") { puts; game_over } > > puts "welcome to my game. please press 'q' to quit." > > while (code = prompt) > case code.strip > when "y" > puts "start game" > when "q" > game_over > else > puts "sorry, i don't understand." > end > end > > -- > Michael Jackson > http://mjijackson.com > @mjijackson thank you MJ my desire generaaly not for func. of this but after press. "y" for example ( at the last line ) prog execution must GOTO beginning of program . may be you now in pascal its easy with GOTO -- Posted via http://www.ruby-forum.com/.