From: Thomas Luedeke Date: 2008-07-28T23:47:13+09:00 Subject: Re: problems with throw/catch (newbie) Robert Klemme wrote: > 2008/7/28 Dave Bass : >> Joshua Ballanco wrote: >>> Yes, that's right, 'goto' can be useful. >> >> Every processor instruction set I've seen has an unconditional jump >> opcode or equivalent. E.g. x86 assembler uses JMP. If it's there we >> should us it. ;-) > > Sorry, but this is ridiculous. Assembler and Ruby are two completely > different pairs of shoes. > > In this case "return" or "break" are far more appropriate IMHO. throw > / catch would also work (module caveats that have been mentioned) but > I always feel reluctant about using those when they are not needed > since they resemble exceptions too closely. > > Cheers > > robert What is annoying to me is that even Fortran 95 has the capability (using "EXIT [construct] name") to get out of deeply nested loops. Why does Ruby force you to use catch/throw (which intuitively seems like exception handling to me). My example above used catch/throw for a single loop, but the reason I asked is that I anticipate having to break out of more deeply nested loops. -- Posted via http://www.ruby-forum.com/.