[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: why no "continue" statement for loops?
- From: Tobias Käs <tobias.kaes@...>
- Date: Wed, 18 Jun 2003 20:10:49 +0200
----- Original Message -----
From: "Curt Carpenter" <firstname.lastname@example.org>
To: "Lua list" <email@example.com>
Sent: Wednesday, June 18, 2003 6:16 PM
Subject: RE: why no "continue" statement for loops?
> It is possible to optimize Nick's version so it looks similar to
It doesn't look similar to me. One has two loops, the other has one. An
extra loop adds complexity.
The inner loop is the only difference I can see.
It does not add complexity as the inner loop is _always_ executed only once.
Since the inner loop is finished with a break, it will never have a chance
for a second execution.
In fact the inner loop only servers to catch the "breaks" in it, so that
they have the effect of a "continue".
The only speed difference to a "real" continue is the additional check for
"break_flag" in the outer loop, which you have as well in the version where
breaks are simulated by continues.