From: "Hal E. Fulton" Date: 2002-07-09T04:33:02+09:00 Subject: Re: for ... else ... end ----- Original Message ----- From: "Dirk Detering" To: "ruby-talk ML" Sent: Monday, July 08, 2002 9:31 AM Subject: Re: for ... else ... end > ts schrieb: > > j = 6 > > catch(:out) do > > for i in 1..10 > > throw :out if i == j > > end > > puts "after" > > end > > > Heaven ... this will recall the Misuse-of-exception Thread > I read some time ago somewhere in a Java forum. > > *argh* :) IMO, this is not a misuse. The throw/catch construct is separate from begin-rescue-end and is often used in Ruby for this kind of control flow issue... Java, by contrast, has only one mechanism. I'm open to debate, though. And by the way, the Pythonism originally referenced is certainly more elegant than the throw/catch example. I wonder if it's useful enough to consider including? Maybe it's one of those things you don't realize you need until you have it. Hal Fulton