Last reviewed: 3/23/2024 12:43:29 PM
<var>
A <var> element declares a variable.
Syntax
<var expr="expression"
name="var" />
Attributes
expr
The initial value of the variable (optional). If there is no expr attribute, the variable retains its current value, if any. Variables start out with the ECMAScript value undefined if they are not given initial values.
name
The name of the variable that will hold the result. Unlike the name attribute of <assign> element, this attribute must not specify a variable with a scope prefix. The scope in which the variable is defined is determined from the position in the document at which the element is declared.
Children
none
Parents
<block>, <catch>, <error>, <filled>, <form>, <help>, <if>, <menu>, <noinput>, <nomatch>, <prompt>, and <transfer>.
Variables
none
Example
The following example illustrates using example elements.
<var name="phone" expr="'6305551212'"/>
<var name="y" expr="document.z+1"/>
Version Information
Supported in: VoiceXML 1.0, VoiceXML 2.0, and VoiceXML 2.1.