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

# expand — Expand macro

EXPAND breaks out of the current control flow and continues with the execution of a macro. It then returns to its original control flow.

Macro expansion allows for code reuse with minimal computational overhead compared to function invocation.

A macro can be coded so that it may expand itself recursively. This technique allows direct implementation of functions defined by mathematical induction and recursive divide and conquer algorithms.

### Attributes
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| macro | var |  | Macro variable name |

### Children
- (none)

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

### Result
- (none documented)

### Examples

```xml
<macro var="outputName">
	<output>$name</output>
</macro>

<set var="name">iXML</set>
<expand macro="outputName"/>

<!-- iXML -->
```

```xml
<macro var="outputName">
	<output>$name&n;</output>
</macro>

<array var="names">
	<item>Bill Gates</item>
	<item>Steve Jobs</item>
</array>

<foreach var="names" var_value="name">
	<expand macro="outputName"/>
</foreach>

<!--
Bill Gates
Steve Jobs
-->
```
