Else and Elseif
Else
Else is something that can be put in a if statement, which means that if the if statement is not equal to what its declaring, it will go to the else statement. A Example is provided below.
local A = false
if A == true then
print("true")
else
print("false")
end
This code will print "false" because since A does not = true, it goes to the else statement.
Elseif
Elseif is a alternate if statement if the first statement does not run. Elseif statements need a else statement no matter what, or else it will return a error.
A Example is provided below.
local A = false
if A == true then
print("true")
elseif A == hi then
print("hi")
else
print("false")
end
Last updated