<if>, <else>, & <elseif> are the three elements utilized for conditional statements in VoiceXML. Each element should utilize a cond attribute specifying an ECMAScript boolean condition. Examples of the usage of each tag are shown below.

Example 1.

<if cond="total > 1000">
    <prompt> This is too much to spend.</prompt>
</if>

Example 2.

<if cond="amount < 29.95">
    <goto next="#debit"/>
<else />
    <prompt>You are out of cash. </prompt>
</if>

Example 3.

<if cond="flavor == 'vanilla'">
    <prompt> You ordered vanilla. </prompt>
<elseif cond="flavor == 'chocolate'" />
    <prompt> You ordered chocolate. </prompt>
<else />
    <prompt> You didn't order vanilla or chocolate. </prompt>
</if>