www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Proposal of a general do-while loop

Don Clugston Wrote:

 Forth has this construct in the form of a BEGIN ... WHILE ... REPEAT loop. I 
 don't think I've seen it elsewhere, though. Uses for it come up fairly 
 frequently in my experience, but as others have mentioned, the for(;;) { aa;
 (cond) break; bb; } idiom isn't too bad.
 Walter uses 'goto' more than any other programmer I've ever seen. Search
 Phobos and the DMD front-end for 'goto', and see how many could be replaced by 
 your do-while loop. Is it a significant fraction of the total?

It is great to know forth has a similar construct. I agree with you that many types of loops can't be written the way I proposed. -Taro
Jul 18 2007