# \[X\] Export scripting: unexpected variable assignment between loops

**URL:** https://community.mp3tag.de/t/x-export-scripting-unexpected-variable-assignment-between-loops/15746
**Category:** No Bugs
**Created:** [May 18, 2014, 9:53pm UTC](https://community.mp3tag.de/t/x-export-scripting-unexpected-variable-assignment-between-loops/15746 "2014-05-18T21:53:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Scripty](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@Scripty](https://community.mp3tag.de/u/Scripty)
#### Post date: [May 18, 2014, 9:53pm UTC](https://community.mp3tag.de/t/x-export-scripting-unexpected-variable-assignment-between-loops/15746/1 "2014-05-18T21:53:00Z")

</div>

1. **Separated loops** , simple.

**How to reproduce:**  
Export any track(s) using config:

```
$loop(,1)$if($eql(1,2),$puts(test,passed),)$loopend()$loop(,1)$get(test)$loopend()

```

Loops can be any others, $eql(1,2) is example of obviously false condition.

**Expected:** output file is empty

**Observed:** output file contain "passed"

2. **Nested loops** , more complicated.

**How to reproduce:**  
Export few (two at least) tracks using config:

```
$loop(%_path%)$if($eql(1,2),$puts(test,passed),)$loop(,1)$get(test)$loopend()$loopend()

```

First loop can be for:

  - %\_path%, %\_filename% - for tracks with different filenames
  - %\_path%, %\_folderpath% - for tracks from different folders
  - %title% - for tracks with different titles
  - etc

**Expected:** output file is empty

**Observed:** output file contain "passed"

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [May 19, 2014, 3:37am UTC](https://community.mp3tag.de/t/x-export-scripting-unexpected-variable-assignment-between-loops/15746/2 "2014-05-19T03:37:17Z")

</div>

> [@Scripty](#):
>
> Export scripting: unexpected variable assignment between loops ... $if($eql(1,2),$puts(test,passed),) ...

The Mp3tag export scripting language is rather special.  
You have to code this way ...

**$loop(,1)$puts(test,$if($eql(1,1),'yes','no'))$loopend()$loop(,1)$get(test)$loopend()**

DD.20140519.0737.CEST

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 28, 2018, 2:34pm UTC](https://community.mp3tag.de/t/x-export-scripting-unexpected-variable-assignment-between-loops/15746/3 "2018-12-28T14:34:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
