lua-users home
lua-l archive

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


On Fri, Aug 14, 2015 at 3:17 PM, Soni L. <fakedme@gmail.com> wrote:
> On 14/08/15 04:08 PM, Jonathan Goble wrote:
>> This can be written in stock Lua without any new features by using
>> nested if blocks:
>>
>> local flag = false
>> if i == 1 or i == 2 then
>>    if i == 1 then
>>      flag = true
>>    end
>>    print(flag)
>> else
>>    print"Unknown!"
>> end
>>
> But now you check for the condition twice.

I never said it was a good way to write it. I just said it was possible.