# \<var>

## \<var>

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

### Attributes

<table><thead><tr><th width="136">Name</th><th width="140.33333333333331">Data type<select><option value="93e44e86d1574d26815d966e85e47b64" label="String" color="blue"></option><option value="b294e576b50a44eabf055201e5f2a482" label="Integer" color="blue"></option><option value="c13ab04720374d14bbeca8e1f9ecd99a" label="Boolean" color="blue"></option></select></th><th>Description</th></tr></thead><tbody><tr><td>name</td><td><span data-option="93e44e86d1574d26815d966e85e47b64">String</span></td><td>The name of the variable that will hold the result.</td></tr><tr><td>expr</td><td><span data-option="93e44e86d1574d26815d966e85e47b64">String</span></td><td><p>The initial value of the variable (optional). If there is no expr attribute, the variable retains its current<br>value, if any.</p><p></p><p>If not given an initial value, variables start out with the ECMAScript value undefined.</p></td></tr></tbody></table>

### Notes

None

### Example

```markup
<?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>](/dev/voicexml/tags/block-tag.md), [\<catch>](/dev/voicexml/tags/catch-tag.md), [\<error>](/dev/voicexml/tags/error-tag.md), [\<filled>](/dev/voicexml/tags/filled-tag.md), [\<foreach>](/dev/voicexml/tags/foreach-tag.md), [\<form>](/dev/voicexml/tags/form-tag.md), [\<help>](/dev/voicexml/tags/help-tag.md), [\<if>](/dev/voicexml/tags/if-tag.md), [\<noinput>](/dev/voicexml/tags/noinput-tag.md), [\<nomatch>](/dev/voicexml/tags/nomatch-tag.md), [\<vxml>](/dev/voicexml/tags/vxml-tag.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.plumvoice.com/dev/voicexml/tags/var-tag.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
