Conditional If/Then/Else Statement
Parameter | Purpose | Example | ||
---|---|---|---|---|
conditions | This is where the condition(s) you want to check will live. | `“a” == 1 && “b” == 2 | ”c” == 3` |
Using Variables in Conditions
You can use variables in your conditional expressions:Nested Conditionals
XanoScript supportselseif
for multi-branch logic. You can use if
, one or more elseif
, and an optional else
block within a conditional
statement.
You can use one
if
, zero or more elseif
, and an optional else
block in a conditional
statement. For more than two branches, prefer elseif
over nested conditionals for clarity.Switch/Case Statements in XanoScript
XanoScript supportsswitch
statements for multi-branch logic. Each switch
can have multiple case
blocks and an optional default
block. Each case
must end with a break
statement.
Example:
- Each
case
must be followed by abreak
statement. - The
default
block is optional and will run if nocase
matches. - You can use variables or expressions in the
switch
value andcase
comparisons.

XanoScript supports
elseif
for multi-branch logic. Use elseif
for clarity when you have more than two branches. switch
statements are also supported as shown above.