[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: orif
- From: Coda Highland <chighland@...>
- Date: Fri, 14 Aug 2015 11:31:56 -0700
On Fri, Aug 14, 2015 at 11:29 AM, <tobias@justdreams.de> wrote:
>
> Quoting "Soni L." <fakedme@gmail.com>:
>
>>
>> With orif:
>>
>> ```lua
>> local flag = false
>> if i == 1 then
>> flag = true
>> orif i == 2 then -- explicit fallthrough
>> print(flag)
>> else -- default
>> print "Unknown!"
>> end
>> ```
>
>
> Lua has elseif which is I think exactly the same:
> local flag = false
> if i == 1 then
> flag = true
> elseif i == 2 then -- explicit fallthrough
> print(flag)
> else -- default
> print "Unknown!"
> end
>
> Regards,
> Tobias
No, elseif is totally different semantics, and elseif is exactly WHY I
think orif is a bad idea: elseif only fires if an earlier condition
wasn't true. orif looks syntactically like it ought to behave like
elseif, but it doesn't.
/s/ Adam