Skip to content

if / else if / else

Control flow

C-style branch. else if emits Luau elseif.

if (cond) {
} else if (other) {
} else {
}
NameTypeDescription
condboolParentheses required.

None (statements).

if / elseif / else / end

There is no ternary ? :. There is no elif spelling — write else if.

if (coins > 50) {
post("Enough balance!");
} else if (coins == 0) {
warn("No coins!");
} else {
report("Balance sync error.");
}

Emits:

if coins > 50 then
print("Enough balance!")
elseif coins == 0 then
warn("No coins!")
else
error("Balance sync error.")
end

guard · switch · match · operator-logic