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
casemust be followed by abreakstatement. - The
defaultblock is optional and will run if nocasematches. - You can use variables or expressions in the
switchvalue andcasecomparisons.
