---
title: "set — Set variable"
description: "iXML command set: Set variable."
canonical_url: "https://www.zeyos.com/ixml/ref/set"
markdown_url: "https://www.zeyos.com/ai/guide/ixml/ref/set.md"
section: "ixml-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/ixmldoc.xml"
source_sha256: "a23f04e6a98628ca3c273c3b8dd2c33c034cfda3e0f00478d8793074fd2f70dd"
---

# set — Set variable

SET sets the value of a variable.

These three statements are semantically equivalent:

					<set var="var[key]">value</set>
					<set var="var.key">value</set>
					<set var="var" key="key">value</set>

					These two statements are semantically equivalent:

					<set var="var[]">value</set>
					<array:push var="var">value</array:push>

### Attributes
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| var | var |  | Variable name |
| key | string | (no key) | Key |

### Children
- (none)

### Parents
- (not restricted in the reference)

### Result
- binding: var; type: string

### Examples

```xml
<set var="firstname">Bill</set>
<set var="lastname">Gates</set>
<output>$firstname $lastname</output>
<!-- Bill Gates -->
```

```xml
<set var="names[bg]">Bill Gates</set>
<set var="names.sj">Steve Jobs</set>
<output>$names.bg and $names[sj] are competitors!</output>
<!-- Bill Gates and Steve Jobs are competitors! -->
```

```xml
<set var="names" key="bg">Bill Gates</set>
<set var="names" key="sj">Steve Jobs</set>
<output>$names.bg and $names[sj] are competitors!</output>
<!-- Bill Gates and Steve Jobs are competitors! -->
```
