Lover of life, just trying to become the best version of me...
Get notified when a new post is published.
The combination of if, elseif, and else now give us more than 2 options, we can have as many cases as are required.
c=3 if c==1 then print("c is 1") elseif c==2 then print("c is 2") else print("c isn't 1 or 2, c is "..tostring(c)) end
c=3
if c==1 then
print("c is 1")
elseif c==2 then
print("c is 2")
else
print("c isn't 1 or 2, c is "..tostring(c))
end
The following words are all reserved for internal functions in Lua.
and, break, do, else, elseif, end, false, for, function, if, in, local, nil, not, or, repeat, return, pairs, then, true, until, while
These words cannot be used for variable names, but Lua is case sensitive, so 'and' is reserved and can't be a variable, but 'aND, aNd, AND, anD, AnD, And, ANd' are not reserved and can be used as variables.