<if>

Description

The <if> element is a conditional logic statement that is used with the optional <elseif> and <else> elements.  It is used to define content to be executed in a specific condition.

Syntax


<if cond="ECMAScript_Expression"> child elements </if>

Attributes

Attribute

Description

cond

An ECMAScript expression to be evaluated and used as a boolean value for this conditional logic statement.  Required.

Parents

Block Catch Error Filled ForEach Help If Noinput Nomatch

Children

Assign Audio Clear Data Disconnect Else ElseIf Enumerate Exit ForEach Goto If Log Prompt Reprompt Return Script Submit Throw Value Var #PCDATA

VoiceGenie Extensions

None

Limitations/Restrictions

Example


<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form> <var name="number_var" expr="5"/> <var name="boolean_var" expr="true"/> <var name="string_var" expr="'hello'"/> <block> <if cond="number_var != 5"> The number is not five. <elseif cond="!boolean_var"/> The boolean is not true. <elseif cond="string_var != 'hello'"/> The string is not hello. <else/> The number is five and the boolean is true and the string is hello. </if> </block> </form> </vxml>