do...while vs. repeat...until (was: Errors aren't that simple)

Miles Bader bader+ at andrew.cmu.edu
Thu Mar 29 05:59:37 AEST 1990


schaut at cat9.cs.wisc.edu (Rick Schaut) writes:
> This is the second request I've seen for a loop construct that allows an
> exit from anywhere in the loop.  Is there something drastically wrong with:
> 
> for(;;) {
>    <statements>
>    if (expr)
>       break;
>    <statements>
> }

You could always extend the syntax of the do-while statement:

    do
	<stmnt>
    while ( <condition> )
	<stmnt>

of which the existing do-while is a special case.  And just THINK of all the
new uncaught errors when someone forgets a semi-colon after a normal
do-while!

-Miles



More information about the Comp.lang.c mailing list