Skip to main content

Conditionals

if — Conditional value execution

Full reference →

The IF command is the primary conditional construct in iXML. It evaluates a comparison and executes its content only if the result is true.

Syntax

XML
<if value1="$a" func="=" value2="$b">
<!-- Executed if a == b -->
</if>

Attributes

NameTypeDescription
value1stringLeft operand.
value2stringRight operand.
funcfunctionComparison operator (default =).

Comparison Operators

funcDescription
=Equals.
!=Not equals.
>Greater than.
<Less than.
>=Greater or equal.
<=Less or equal.
~Regex match.
!~Regex non-match.

is — Conditional type check

Full reference →

The IS command checks the validity, type, or state of a single variable.

Syntax

XML
<is var="myVar" type="numeric">
<!-- Executed if myVar is numeric -->
</is>

Common Types

  • valid (defined and not null/false)
  • empty (null, false, empty string, empty array)
  • array, string, int, float, bool
  • numeric

switch — Multi-way branching

Full reference → | case reference → | default reference →

The SWITCH command simplifies chains of if-elseif statements comparing a single value against multiple options.

Syntax

XML
<switch value="$status">
<case value="active">Active!</case>
<case value="pending">Pending...</case>
<default>Unknown status</default>
</switch>