# $loop() for dummies

**URL:** <https://community.mp3tag.de/t/loop-for-dummies/17145>\
**Category:** Export\
**Created:** [August 13, 2015, 1:14pm UTC](https://community.mp3tag.de/t/loop-for-dummies/17145 "2015-08-13T13:14:10Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![rko31415](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/f19dbf/32.png) [@rko31415](https://community.mp3tag.de/u/rko31415)\
**Post date:** [August 13, 2015, 1:14pm UTC](https://community.mp3tag.de/t/loop-for-dummies/17145/1 "2015-08-13T13:14:10Z")

</div>

I'm not a programmer, but I find the export configuration function in mp3tag to be quite powerful for maintaining and reporting on my podcast collection, and so I muddled through. What I've found through trial-and-error is you should think about the $loop more as a sort function. This is not based on any real knowledge, rather on my reading of the output from many dozens of my hand-built export configuration files.

The $loop parameter, the %album% in $loop(%album%), sorts your mp3tag listing before executing your export code. For example, $loop(%album%) sorts your mp3tag selection by album, then executes your export code line by line on the results.

$loop(%dummy%) would execute your code based on your last manual sorting operation. $loop(%album%)$loop(%title%) sorts your mp3tag listing first by title, then by album, and then executes your code (note the reverse order).

$loop()$loop()$loopend()$loopend() does NOT execute your code twice. It merely sorts twice then executes your code once. To execute code twice use $loop()...coding...$loopend() $loop()...coding...$loopend().

If you have an export configuration that should execute differently depending on how the mp3tag listing is sorted, then you should use %dummy% as the $loop parameter. For example, I use an export configuration to print out playlists. For podcasts that need to be listened to in order, I first sort manually by track and then run the export configuration. For podcasts that can be listened to in any order, I first sort manually by random.

This at least is how I see it. I welcome any clarifications.

---

_[View the full topic](https://community.mp3tag.de/t/loop-for-dummies/17145)._
