<assign>

The <assign> element assigns a value to a predefined variable.

Attributes

name The name of the variable being assigned to.
expr An ECMAscript expression to be evaluated, the results of which are assigned to the named variable.

Notes

The variable specified by the "name" attribute in the <assign> tag should be declared in a <var> tag first.


Example

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <!-- test_var is declared here -->
    <var name="test_var"/>
    <block>
      <!-- test_var must be declared before assigning it a value -->
      <assign name="test_var" expr="1234"/>
    </block>
    <block>
      <prompt>
        The test variable is set to <value expr="test_var"/>.
      </prompt>
    </block>
  </form>
</vxml>

The output of the above script would be:

Computer: The test variable is set to twelve hundred thirty-four.



Child Tags

None



Parent Tags

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