<if cond="">

A conditional statement used to determine what the application executes on the basis of the evaluation of one or more variables.

The value in cond="" must be an expression containing the following three elements: 1) a value, variable or function; 2) an operator; and 3) another value, variable or function.

There must be no spaces in the expression other than spaces that may be present in a text string value.

All variables used in the conditional statement must have been defined (using <assign name=""/> or <get>) before the conditional statement, either above the conditional statement in the same node, in a previous node, or in <settings> (using <assign name="" expr=""/>). If they are undefined, they will cause an error. Likewise, if an existing variable is assigned a new value using <assign name="" expr=""/>, this must be done before the conditional statement if the new value is to be evaluated.

Constants in conditional statements must be placed in single quotes; variables must not.

Allowed operators are:
== is equal to*
!= is not equal to
> is greater than
< is less than
>= is greater than or equal to
<= is less than or equal to
* Note that two equal signs are used in evaluation rather than assignment.

Child of: <node name=""> or any multi-line tag at any level within <node name="">
Parent of: Nothing

Example:

<medias>
<if cond="user_visits=='1'">
                        <media>
                                    <file>first_time_welcome.mp4</asset>
</media>
<elseif cond="user_visits=='2'"/>
                        <media>
                                    <file>second_time_welcome.mp4</asset>
</media>
<else/>
                        <media>
                                    <file>generic_welcome.mp4</asset>
</media>
</if>
</medias>

Working example: Search for <if cond="">...<elseif cond=""/>...<else/>...</if> in the file trivia_demo.xml.