Table of Contents

< assign >

Description

The <assign> element assigns a value to a variable. It is illegal to make an assignment to a variable that has not been explicitly declared using a <var> element or a <var> statement within a <script>. Attempting to assign an undeclared variable causes an error.semantic event to be thrown.

Syntax

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

Attributes

nameThe name of the variable being assigned to. This is required.
exprThe value to assign to the variable. This is required.

In the expr content you can escape special characters (with “\”) : “Bonjour, je suis l\'assistant téléphonique… '”.

Parents

<block>, <catch>, <error>, <filled>, <help>, <if>, <noinput>, <nomatch>

Children

None.

Extensions

None.

Limitations/Restrictions

None.

Example Code

<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 <var name="tree" expr="'an apple tree'"/>
 <form>
  <block>
   <prompt> The initial value is <value expr="tree"/> </prompt>
   <assign name="tree" expr="'apple orchards'"/>
   <prompt> The new value is <value expr="tree"/> </prompt>
  </block>
 </form>
</vxml>