---
title: "<variable> Element"
url: https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-xml-reference/variable-descriptor-element
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# \<variable> Element

A `variable` element defines a [variable](https://docs.zeroc.com/ice/3.8/services/icegrid/using-descriptor-variables-and-parameters.md).

This element may only appear as a child of an [application](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-xml-reference/application-descriptor-element.md) element or [node](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-xml-reference/node-descriptor-element.md) element.

The following attributes are supported:

| **Attribute** | **Description** | **Required** |
| --- | --- | --- |
| `name` | Specifies the variable name. The value of this variable is substituted whenever its name is used in variable syntax, as in `${name}`. | Yes |
| `value` | Specifies the variable value. If not defined, the default value is an empty string. | No |

Here is an example to demonstrate the use of this element:

```xml
<icegrid>
    <application name="SampleApp">
        <variable name="Var1" value="foo"/>
        <variable name="Var2" value="${Var1}bar"/>
        ...
    </application>
</icegrid>
```

## See Also

- [Using Descriptor Variables and Parameters](https://docs.zeroc.com/ice/3.8/services/icegrid/using-descriptor-variables-and-parameters.md)
- [Application Descriptor Element](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-xml-reference/application-descriptor-element.md)
- [Node Descriptor Element](https://docs.zeroc.com/ice/3.8/services/icegrid/icegrid-xml-reference/node-descriptor-element.md)
