lua-users home
lua-l archive

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


Michael Newberry wrote:
Luiz, OK, thanks. 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


I think I generally use something like:

str = S:Next()
while str do
  -- [code]
  str = S:Next()
end

which is no more compact, but I prefer it anyway, especially for a simple "next" assignment like that.
--
Antony Sidwell