From: GGarramuno@... (GGarramuno) Date: 2004-01-05T10:33:09+09:00 Subject: Re: Loop/Iterator questions Austin Ziegler wrote in message news:<200414145957.997798@PADD>... > > As Jamis said, you want: > > while $stdin.getc > begin > catch(:arg) do > p "A" > while true > p "B" > throw :arg if true > end > end > ensure > p "ensure" > end > end > Hmm... Well, that's what I thought at first, but I had quickly discarded the idea as not right. Yet, it does work. I am obviously missing some other gotcha here. In the above example, by placing the catch where it is, the way I read it was that $stdin.getc gets run only once, instead of in each iteration (ie. the while condition is not evaluated as it is OUTSIDE the catch do/end, just as is the ensure block)? This is what's loosing me. What's the logic -magic- that makes it all work? Or to put in another way, what if I wanted to have a catch() that is inside the first while loop but does not evaluate the condition nor runs the ensure block (say, just to backtrace the code like an ugly goto command)? How would that look like? Or that's just not possible (and thus it explains why the above thing always gets interpreted the way we intended)?