< if >

The < if > element defines if-then-else conditional logic.

child elements
condThe cond attribute is a Boolean expression for the conditional logic statement. This attribute is required.
<block>, <catch>, <error>, <filled>, <help>, <if>, <noinput>, <nomatch>
<assign>, <audio>, <clear>, <disconnect>, <else>, <elseif>, <enumerate>, <exit>, <goto>, <if>, <prompt>, <reprompt>, <return>, <script>, <submit>, <throw>, <value>, <var>
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 <var name="card_type" expr="'amex'" />
  <field name="card_num" type="digits">
   <prompt>What is your card number?</prompt>
    <if cond="card_type == 'amex' &amp;&amp; card_num.length != 15">
     American Express card numbers must have 15 digits.
     <clear namelist="card_num"/>
    <elseif cond="card_type != 'amex' &amp;&amp; card_num.length != 16"/>
     Mastercard and Visa card numbers have 16 digits.
     <clear namelist="card_num"/>