# Export, $Puts() is executed always

**URL:** https://community.mp3tag.de/t/export-puts-is-executed-always/14084
**Category:** Export
**Created:** [November 4, 2012, 3:46pm UTC](https://community.mp3tag.de/t/export-puts-is-executed-always/14084 "2012-11-04T15:46:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [November 4, 2012, 3:46pm UTC](https://community.mp3tag.de/t/export-puts-is-executed-always/14084/1 "2012-11-04T15:46:46Z")

</div>

I found out put() and puts() statements are executed even the execution flow does not pass from that point.  
A very simple code.

```
$put(myvar,'a')
$if($eql(1,2),$puts(myvar,'bcdef'),'1 = 2')
$get(myvar)
Output of this code is
a
1 <> 2
bcdef

```

Variable myvar is set to 'bcdef' even $puts() is not meant to be called because of $if condition (1==2).  
Very disappointing...  
Is this behavior since the beginning of mp3Tag?

---

<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: [November 4, 2012, 4:03pm UTC](https://community.mp3tag.de/t/export-puts-is-executed-always/14084/2 "2012-11-04T16:03:24Z")

</div>

> [@Victor Kostas](#):
>
> I found out put() and puts() statements are executed even the execution flow does not pass from that point. ... Very disappointing... Is this behavior since the beginning of mp3Tag?

My experience is, that the functions $put/$puts cannot be used as an argument within an expression.  
I use the function $put/$puts always at the top most level.

For example (this is a different algorithm than yours, just to show the principle) ...  
$put(myvar,'a')  
$puts(myvar,$if($eql(1,2),'bcdef','1 \<\> 2'))  
$get(myvar)

See also ...  
[/t/3727/1](https://community.mp3tag.de/t/3727/1)  
[Check if field value is identical for all selected tracks](https://community.mp3tag.de/t/13244/5)

DD.20121104.1800.CET

---

<div class="post-metadata">

### Author: ![vkostas](https://community.mp3tag.de/user_avatar/community.mp3tag.de/vkostas/32/227_2.png) [@vkostas](https://community.mp3tag.de/u/vkostas)
#### Post date: [November 4, 2012, 4:10pm UTC](https://community.mp3tag.de/t/export-puts-is-executed-always/14084/3 "2012-11-04T16:10:04Z")

</div>

> [@DetlevD](#):
>
> My experience is, that the functions $put/$puts cannot be used as an argument within an expression.  
> I use the function $put/$puts always at the top most level.
> 
> For example (this is a different algorithm than yours, just to show the principle) ...  
> $put(myvar,'a')  
> $puts(myvar,$if($eql(1,2),'bcdef','1 \<\> 2'))  
> $get(myvar)
> 
> DD.20121104.1800.CET

I understand your point. Do you think someone can confirm how mp3tag was designed to use $put/$puts statements?

---

<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: [November 4, 2012, 4:31pm UTC](https://community.mp3tag.de/t/export-puts-is-executed-always/14084/4 "2012-11-04T16:31:11Z")

</div>

> [@Victor Kostas](#):
>
> I understand your point. Do you think someone can confirm how mp3tag was designed to use $put/$puts statements?

Yes, I assume there is _one_, who is able to do so.

DD.20121104.1828.CET
