lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, 28 Jan 2011, Sean Conner wrote:
>
>   Also, is the issue with coninue this?
>
> 	repeat
> 	  code()
> 	  if blah then contiue end
> 	  local i
> 	  more_code()
> 	until i

Yes.

> In C, a continue in a "do ... while" skips the conditional test.

For the second time, no it does not. A continue jumps to the end of the
loop body.

The C99 standard says:

  6.8.6.2 The continue statement

  Constraints

  1 A continue statement shall appear only in or as a loop body.

  Semantics

  2 A continue statement causes a jump to the loop-continuation portion of
    the smallest enclosing iteration statement; that is, to the end of the
    loop body. More precisely, in each of the statements

        while (/* ... */) {
            /* ... */
            continue;
            /* ... */
        contin: ;
        }

        do {
            /* ... */
            continue;
            /* ... */
        contin: ;
        } while (/* ... */);

        for (/* ... */) {
            /* ... */
            continue;
            /* ... */
        contin: ;
        }

    unless the continue statement shown is in an enclosed iteration
    statement (in which case it is interpreted within that statement), it
    is equivalent to goto contin;.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
HUMBER THAMES DOVER WIGHT PORTLAND: NORTH BACKING WEST OR NORTHWEST, 5 TO 7,
DECREASING 4 OR 5, OCCASIONALLY 6 LATER IN HUMBER AND THAMES. MODERATE OR
ROUGH. RAIN THEN FAIR. GOOD.