topbartopbar
FORUM TUTORIAL


Conditional Statements

<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>

 

Tutorials





    About   |   News   |   Membership   |   Technology   |   Certification   |   Resources   |   FAQ  |  Sitemap   |   Contact

Copyright © 2000 - 2004 VoiceXML Forum. All rights reserved.
The VoiceXML Forum is a program of the
IEEE Industry Standards and Technology Organization (IEEE-ISTO)
For inquiries contact voicexml-admin@voicexml.org
This site is maintained by the VoiceXML Forum Webmaster