Skip to main content

Conditional type execution

Anatomy

<is var="var" type="valid">
<elseif value1="string" value2="string|regexp" func="string">ixml</elseif>
<elseis var="var" type="type">ixml</elseis>
<else>ixml</else>
</is>

Description: The IS construct is a control flow structure that allows for conditional execution of code dependent on the data type of a variable.

If the condition is true, the embedded code is executed. Otherwise, a series of embedded ELSEIF and ELSEIS statements is tested one by one. Only the first ELSEIF or ELSEIS statement that is found to be true will be executed. If none of the conditions are true, the embedded ELSE statement will be executed instead.

Attention:

IS will propagate results into the context of its paternal statement.

Attributes

NameTypeDescriptionDefined By
varvarVariable name is
typetypeType is

Children

elseif

Anatomy of Elsewise conditional value execution

<elseif value1="string" value2="string|regexp" func="string">ixml</elseif>

Attributes:

NameTypeDescription
value1stringValue to compare from
value2stringregexp
funcstringComparison function
elseis

Anatomy of Elsewise conditional type execution

<elseis var="var" type="type">ixml</elseis>

Attributes:

NameTypeDescription
varvarVariable name
typetypeType
else

Anatomy of Elsewise execution

<else>ixml</else>

Examples

Example

<set var="name">iXML</set>

<is var="name" type="string">
<output>My name is a string!</output>
</is>

<!-- My name is a string! -->