lua-users home
lua-l archive

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


----- Original Message ----- 
From: "Curt Carpenter" <curtc@microsoft.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
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
yours.
It doesn't look similar to me. One has two loops, the other has one. An
extra loop adds complexity.

Curt
-----------------------------

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.