From: mathew Date: 2005-11-26T00:59:18+09:00 Subject: Re: semenatics of if/unless/while statement modifiers On Nov 22, 2005, at 12:42 PM, David A. Black wrote: > On Wed, 23 Nov 2005, mathew wrote: >> >> >> >> That's a block and a single statement, rather than a loop construct. >> >> A real post-test loop would be something like >> >> repeat ... until x >> >> with no extra do ... end required. >> >> And I think that do ... end while x is ugly too. I tend to prefer >> doing something to make the loop condition true initially, then >> doing a normal while loop. >> > > There's no "do" in the example; it's begin...end. The "begin" isn't > "extra" (any more than "repeat" would be), since otherwise you'd have > no way to know where the body started. > > I think it's plenty "real" as is :-) It's the 'end' that's extra, not the 'do'. I guess I elided too much... Let's try again: do x = x + 1 while x < 10 vs do x = x + 1 end while x < 10 The former is a true post-test loop, in that it is a construct like if..end or while..end that can enclose multiple statements on its own. The latter uses a 'do' block to enclose the multiple statements, and couples it to a while condition. And as Matz has just pointed out on this list, the two don't have exactly the same semantics, at least as while is implemented today. mathew