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

# swap — Swap variables

SWAP swappes the values of two variables.

### Attributes
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| var1 | var |  | Variable name 1 |
| var2 | var |  | Variable name 2 |

### Children
- (none)

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

### Result
- binding: var1; type: n/a; predicate: no-result-propagation
- binding: var2; type: n/a; predicate: no-result-propagation

### Examples

```xml
<set var="name1">XML</set>
<set var="name2">iXML</set>
<swap var1="name1" var2="name2"/>
<output>My name is "$name1" &amp; I am a $name2 derivative!</output>
<!-- My name is "iXML" & I am a XML derivative! -->
```
