Last reviewed: 3/23/2024 11:58:09 AM
In this article
<assign>
An <assign> element sets a variable value.
Syntax
<assign expr="varval"
name="var" />
Attributes
expr
The new value of the variable.
name
The name of the variable being assigned to. The corresponding variable must have been previously declared otherwise an error.semantic event is thrown. By default, the scope in which the variable is resolved is the closest enclosing scope of the currently active element. To remove ambiguity, the variable name may be prefixed with a scope name.
Children
none
Parents
<block>, <catch>, <error>, <filled>, <help>, <if>, <noinput>, <nomatch>, and <prompt>.
Variables
none
Example
The following example illustrates setting variable values.
<assign name="flavor" expr="'chocolate'"/>
<assign name="document.mycost" expr="document.mycost+14"/>
Version Information
Supported in: VoiceXML 1.0, VoiceXML 2.0, and VoiceXML 2.1.