From: Song Choe Date: 2009-03-13T00:31:21+09:00 Subject: Newbie question about throw & catch. --_9616f68c-8320-4a6d-a419-cee8dc772025_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable HI. Everyone. Real newbie question with throw & catch. =20 I am running the book example. def promptAndGet(prompt) print prompt res =3D readline.chomp throw :quitRequested if res =3D=3D "!" return res end catch :quitRequested do name =3D promptAndGet("Name: ") age =3D promptAndGet("Age: ") sex =3D promptAndGet("Sex: ") # .. # process information end promptAndGet("Name:")When I run this and type "!" for every prompt(2) then = I get the following errortemp1.rb:4:in `throw': uncaught throw `quitRequest= ed' (NameError) from temp1.rb:4:in `promptAndGet' from temp1.rb:19Isn't catch supposed to run when "!" is ran? =20 If I don't put "!" on first prompt=2C I was expecting the program to end=2C= but the catch block runs anyway and asks the Name at the end again. Name: song Age: 4 Sex: m Name:songPlease somebody help me explain how this throw & catch flow works.= =20 Thank you. _________________________________________________________________ Hotmail=AE is up to 70% faster. Now good news travels really fast.=20 http://windowslive.com/online/hotmail?ocid=3DTXT_TAGLM_WL_HM_70faster_03200= 9= --_9616f68c-8320-4a6d-a419-cee8dc772025_--