lua-users home
lua-l archive

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


After all this endless discussion about "for" syntax one simple question:

Why not simply write

local function f() return 1, 5 end
local a,b = f()
for i = a,b do print(i) end


although I have to admit, that then you have to distinguish between two or three parameters for the for-loop "manually".


Am 13.09.2012 14:10, schrieb Egor Skriptunoff:
Why this simple code

for i = 1, 5 do print(i) end

cannot be written in more general form ?

local function f() return 1, 5 end
for i = f() do print(i) end

-- Egor