if / else if / else
C-style branch. else if emits Luau elseif.
Syntax
Section titled “Syntax”if (cond) {} else if (other) {} else {}Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
cond | bool | Parentheses required. |
Return value
Section titled “Return value”None (statements).
Luau emit
Section titled “Luau emit”if / elseif / else / end
Description
Section titled “Description”There is no ternary ? :. There is no elif spelling — write else if.
Example
Section titled “Example”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.")endSee also
Section titled “See also”guard · switch · match · operator-logic