lua-users home
lua-l archive

Re: Assignment in functional conditionals, any alternative?

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


RLake@oxfam.org.uk wrote:
> It certainly works for your first example, with a while statement
> (with limited scope):
> 
> (*) while x := foo() do print(x) end (to use Mark's syntax)
> 
> is simply
> 
> for x in foo do print(x) end
This is not entirely true on at least two accounts:
1) foo will be called with 2 arguments instead of none.
2) the for loop will _not_ stop for x==false, but only for x==nil.
Bye,
Wim

AltStyle によって変換されたページ (->オリジナル) /