Re: what's wrong with this loop syntax?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: what's wrong with this loop syntax?
- From: Shmuel Zeigerman <shmuz@...>
- Date: 2007年1月08日 23:38:15 +0200
Michael Newberry wrote:
Is there any way to make it more compact (and more
readable to me, at least), where the loop is tested at the top of the
loop? Here is what I use:
while true do
str = S:Next()
if str == nil then break end
-- [code]
end
local function strings(S)
return function() return S:Next() end
end
for str in strings(S) do
-- [code]
end
--
Shmuel