[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple values returned or vararg expression in numeric for loop
- From: Egor Skriptunoff <egor.skriptunoff@...>
- Date: Fri, 14 Sep 2012 14:09:42 +0400
On 9/14/12, Dimitris Papavasiliou <dpapavas@gmail.com> wrote:
> for v = f() do ... end
> if you use a function call one would expect it to work like:
> v = f()
> in which case the returned values would be adjusted to a single value
> as happens for the for statement. You can therefore treat the part of
> the for statement that looks like an assignment as an actual
> assignment in terms of semantics. From this point of view not
> adjusting the values returned by f would be then inconsistent thing to
> do.
Yes, it can be confusing a bit for Lua newbies.
But current syntax is also confusing exactly the same way:
for i = 1, 5 do ... end
One can erroneously treat it as an assignment because of '=' sign.
- References:
- Multiple values returned or vararg expression in numeric for loop, Egor Skriptunoff
- Re: Multiple values returned or vararg expression in numeric for loop, Dirk Laurie
- Re: Multiple values returned or vararg expression in numeric for loop, Egor Skriptunoff
- Re: Multiple values returned or vararg expression in numeric for loop, Frank Meier-Dörnberg
- Re: Multiple values returned or vararg expression in numeric for loop, Dimitris Papavasiliou
- Re: Multiple values returned or vararg expression in numeric for loop, Hisham
- Re: Multiple values returned or vararg expression in numeric for loop, Coda Highland
- Re: Multiple values returned or vararg expression in numeric for loop, Egor Skriptunoff
- Re: Multiple values returned or vararg expression in numeric for loop, Martijn van Buul
- Re: Multiple values returned or vararg expression in numeric for loop, Dimitris Papavasiliou