<var>

Description

Declares a variable in the scope of its parent element.  If the <var> occurs in executable content, the declaration is made only when the <var> element is executed.  If the <var> occurs as a child of a <form>, the declaration is made during the form's initialization phase.  If the <var> occurs as a child of <vxml>, the declaration is made when the document is initialized (in document order).  If the variable is already defined in the current scope, further declarations are treated as value assignments.

Syntax


<var name="string" expr="ECMAScript_Expression"/>

Attributes

Attribute

Description

name

The name of the variable. Required.

expr

An ECMAScript expression to be evaluated and used as the initial value assigned to the variable. Optional. (Defaults to undefined.)

Parents

Block Catch Error Filled ForEach Form Help If Noinput Nomatch Vxml

Children

None

VoiceGenie Extensions

None

Limitations/Restrictions

Example


<?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <var name="var1" expr="'first'"/> <form> <block> The initial value is <value expr="var1"/>. </block> </form> </vxml>