From: David Vallner Date: 2006-11-07T07:39:38+09:00 Subject: Re: Ruby script auto-closes at completion --------------enigFC7EA2AAE723C64B2258B512 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable John Tar wrote: > Hi >=20 > I am a newbie. I am trying to run some small ruby programs to learn a=20 > bit about ruby. >=20 > everytime i run the following program in windows it auto closes when it= =20 > is done, so there is no time to see the final result >=20 > is there any way to allow it to just freeze and not autoclose...the way= =20 > i was doing it,is by putting a gets at the end....but i am sure there i= s=20 > a better way >=20 > thanks >=20 > john >=20 > code: >=20 >=20 > puts 'what is you first name?' > name =3D gets.chomp > a=3Dname.length.to_i > puts a >=20 > puts 'what is you midlle name?' > mname=3Dgets.chomp > b=3Dmname.length.to_i > puts b >=20 > puts 'what is you last midlle name?' > lname=3Dgets.chomp > c=3Dlname.length.to_i > puts c >=20 > d=3Da+b+c >=20 > puts 'there are ' + d.to_s + ' characters in your name:' +=20 > mname.swapcase >=20 >=20 >=20 >=20 A method using less busywork to run the script itself would be adding: puts "Press ENTER to close." gets at the end of the script. This should only be done in interactive programs, and is a workaround, but it's Good Enough. David Vallner --------------enigFC7EA2AAE723C64B2258B512 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) iD8DBQFFT7mKy6MhrS8astoRAtB4AJ4nlFylvlMxGeLsk9JV/vs2n/xSvACeNUcR RKHBTZf1Nj11JvZLCFoRivg= =KhEi -----END PGP SIGNATURE----- --------------enigFC7EA2AAE723C64B2258B512--