[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: orif
- From: Jonathan Goble <jcgoble3@...>
- Date: Fri, 14 Aug 2015 15:08:26 -0400
On Fri, Aug 14, 2015 at 3:01 PM, Soni L. <fakedme@gmail.com> wrote:
> orif is the or operator combined with elseif.
>
> It's similar to this (if Lua allowed this):
>
> local flag = false
> if i == 1 then
> flag = true
> goto next
> elseif i == 2 then
> ::next::
> print(flag)
> else
> print"Unknown!"
> end
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