[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: Sean Conner <sean@...>
- Date: Fri, 28 Jan 2011 14:48:31 -0500
It was thus said that the Great Tony Finch once stated:
>
> > If you keep the similar behavior of "continue" in C into Lua, then:
>
> Note that there is a significant difference in the scoping rules between C
> and Lua:
>
> do {
> int i;
> } while (f(i)); // ERROR: i is not in scope
>
> repeat
> local i
> until f(i) -- ok: i is in scope
It doesn't seem right to me that until has access to the inner scope of
the loop; isn't that violating the scope or something like that?
Also, is the issue with coninue this?
repeat
code()
if blah then contiue end
local i
more_code()
until i
Or with this?
repeat
local i
code()
if blah then continue end
more_code()
until i
Or both? I'm not sure what the problem is. In C, a continue in a "do ...
while" skips the conditional test. Is the issue the conditional test? Or
the creation of the locally scoped variable?
-spc
- 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