Lua - if elseif else statement

Published 2014/03/03 by Admin in LUA

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


The following words are all reserved for internal functions in Lua.

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.


my coding

This is a collection of all the coding gems I have found and would like to share with the world!