From: cppcodeguy@... Date: 2010-07-27T08:29:24+09:00 Subject: Re: stop program with entering a key... ----------MB_8CCFB318032F215_11C0_7ACA_webmail-m074.sysops.aol.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" Use puts to print the screen and gets to get the user's input. I'm guessing you want to add something like puts "pls press -1 to stop game" answer =3D gets if answer.to_i =3D=3D -1 or answer =3D=3D randomnumber puts "Continue or stop? (y/n)" answer =3D gets if answer.chomps =3D=3D "y" puts "Thank you for playing, game over." Process.exit end end =20 Was that any help? -----Original Message----- From: hazal Ates To: ruby-talk ML Sent: Mon, Jul 26, 2010 5:06 am Subject: stop program with entering a key... i m a new in Ruby . sorry may be its a silly question. my small game " finding a randon number" in codes i want to put "pls press -1 to stop game" or end of first game i want to ask "do you cont. or stop ( y / n ) enter , pls" but i dont know that how (-1) or y/n work to stop or cont. i want to like this code : if keyenter=3D(-1) goto last line and stop if keyenter =3D y goto beginning of game if keyenter =3D n goto end of prog. it says puts "thank you , game over" like this... --=20 Posted via http://www.ruby-forum.com/. =20 =20 ----------MB_8CCFB318032F215_11C0_7ACA_webmail-m074.sysops.aol.com--