[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: I'd give my right arm for a continue statement
- From: Tony Finch <dot@...>
- Date: Fri, 28 Jan 2011 19:58:59 +0000
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.
- References:
- Re: I'd give my right arm for a continue statement, Michal Kottman
- Re: I'd give my right arm for a continue statement, steve donovan
- Re: I'd give my right arm for a continue statement, Alexander Gladysh
- Re: I'd give my right arm for a continue statement, steve donovan
- Re: I'd give my right arm for a continue statement, Roberto Ierusalimschy
- Re: I'd give my right arm for a continue statement, Axel Kittenberger
- Re: I'd give my right arm for a continue statement, Axel Kittenberger
- Re: I'd give my right arm for a continue statement, Lucas Zawacki
- Re: I'd give my right arm for a continue statement, Sean Conner
- Re: I'd give my right arm for a continue statement, Tony Finch
- Re: I'd give my right arm for a continue statement, Sean Conner