From: Dirk Detering Date: 2002-07-09T23:05:12+09:00 Subject: Re: for ... else ... end Austin Ziegler schrieb: > I can't say that I like the construct, although I can see its > utility. I'm also not sure that it fits into what I understand how > it would fit into Ruby's idiom better than the catch-throw > mechanism. To repeat myself: What possibilities does Ruby currently have to express the following scheme completely? (parts of it have just been shown in this thread): iterate over elements in container if no elements were found do ... if loop completes without break do ... if loop has been interrupted with break do ... Can all this *easily* be expressed via catch/throw ? We should create a complete example. (Although I don't think that all branches would be used at the same time ... (?) ). > > The problem I have with it is that 'for' is (more or less) syntactic > sugar for 'each', isn't it? As I said before: Must this stay to be sugar for each ? or can it be sugar for catch/throw too? And: Must this stay to be only syntactic sugar? Or can it become more, up to an own syntax construct? And: Well, I'm now interested in this 'more or less'. For example scoping seems to be one difference... > It isn't necessary to do: > > for ... do > ... > end > > Because it's the same as: > > ...each do > ... > end Regarding the readability, yes. But it seems to have effect on the '...' _inside_ this construct. Bye Det