Can You do more than 1 if and elseif? Not really much to my description but can you do that though?
More than 1 "If"?
2 answers
Please attempt to actually try this yourself before asking here:
An if statement is limited to one if and one else, but you can have any number of elseifs:
if COND then
--code
elseif OTHERCOND then
--code
elseif THIRDCOND then
--code
else
--code
end
--Else and elseif are not necessary:
if COND then
--code
end
if COND then
--code
else
--code
end
if COND then
--code
elseif OTHERCOND then
--code
end
3 comments
It is good to note that really large if elseif else trees are usually a sign that you should use a dictionary or other explicit formula instead.
This is truth, but it's impossible to know which is better without a situation to apply it to.
I have a feeling he might've been asking about nested if statements.
Example
local value1 = 0
if value1 == 1 then
print("1")
else
if value1 == 0 then
print("0")
end
end
6 comments
It would need to be else (skip a line then) if
You cant have more then 1 elseif statements only 1
You can use more than 1 'elseif' statement.
You almost never use it though @TheAlphaStigma
There are many cases where that is false, DevScripting. Why would you avoid useing elseif anyway? It's a lot easier to type.
That is incorrect information; I use it almost all the time in the Scripting Field for some of my experiments, as do other scripters, to me, it is primarily used for 'debugging'. @DevScripting
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
You can use multiple 'elseif' statements for an 'if' statement, however, you can only use one 'else' for an 'if' statement; The 'else' keyword is kind of like an 'if-all-else-fails-then', the 'elseif' keyword is kind of like 'if-this-doesn't-work-and-another-does-then'.