[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: upcoming changes in Lua 5.2
- From: "Alexander Gladysh" <agladysh@...>
- Date: Tue, 26 Feb 2008 15:41:55 +0300
> > Continue contradicts with my understanding of single exit point idiom.
>
> I think you meant "break", not "continue".
Hmm. Break definitely. But continue too. Like this (silly example in C++):
for (int i = 0; i < 10; ++i)
{
if (i % 2)
{
continue;
}
printf("odd %d", i);
}
Might be improved (from the point of readability) as
for (int i = 0; i < 10; ++i)
{
if (!(i % 2))
{
printf("odd %d", i);
}
}
I treat continue in the first example as an another exit from the loop
iteration. Think of refactoring loop body to a function, and replacing
continue with return.
Alexander.
- References:
- Location of a package, Ignacio Burgueño
- Re: Location of a package, eugeny gladkih
- upcoming changes in Lua 5.2 [was Re: Location of a package], Roberto Ierusalimschy
- Re: upcoming changes in Lua 5.2 [was Re: Location of a package], Shmuel Zeigerman
- Re: upcoming changes in Lua 5.2 [was Re: Location of a package], Roberto Ierusalimschy
- Re: upcoming changes in Lua 5.2 [was Re: Location of a package], Asko Kauppi
- Re: upcoming changes in Lua 5.2 [was Re: Location of a package], Doug Rogers
- Re: upcoming changes in Lua 5.2, Miles Bader
- Re: upcoming changes in Lua 5.2, Alexander Gladysh
- Re: upcoming changes in Lua 5.2, Leo Razoumov