<var>

<var>

This element declares a variable. It can occur in executable content or as a child of <form> or <vxml>.

Attributes

NameData typeDescription

name

String

The name of the variable that will hold the result.

expr

String

The initial value of the variable (optional). If there is no expr attribute, the variable retains its current value, if any.

If not given an initial value, variables start out with the ECMAScript value undefined.

Notes

None

Example

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <var name="test_var"/>
    <block>
      <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>, <form>, <help>, <if>, <noinput>, <nomatch>, <vxml>

Last updated