# Script transform unexpectedly return array

**URL:** <https://forum.inductiveautomation.com/t/script-transform-unexpectedly-return-array/66444>\
**Category:** Ignition\
**Created:** [November 14, 2022, 12:06am UTC](https://forum.inductiveautomation.com/t/script-transform-unexpectedly-return-array/66444 "2022-11-14T00:06:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [November 14, 2022, 12:06am UTC](https://forum.inductiveautomation.com/t/script-transform-unexpectedly-return-array/66444/1 "2022-11-14T00:06:21Z")

</div>

Got an odd one.

I was trying to set up a script transform to essentially check the data type of a parameter, and output one of two strings based on the result. It was behaving oddly, and I managed to isolate it down to something I simply can't explain.

I reduced my script transform to:

```auto
if True:
    return 'yes'
else:
    return 'no'

```

Then I toggle it between `if True` and `if False` and it should return either `yes` or `no`.

If I type that out, that's exactly how it behaves. But if I copy and paste in the following:

```auto
if True:
	return 'yes',
else:
	return 'no'

```

...which appears to be identical, it doesn't return `yes` or `no`, it returns `[yes]` or `no`. That is, the first value returned is a single element array.

Try it yourself. Copy and paste the top code block into a script transform, and it'll return `yes`. Copy and paste the bottom code block into a script transform, and it'll return `[yes]`

What the heck is going on here?  
 ![Screen Shot 2022-11-14 at 10.40.30 am](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/8/b8e07eeb598cdab280d2e0fdba4cf7726241acc7.png)  
 ![Screen Shot 2022-11-14 at 10.40.41 am](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/f/9f384a593d508db4f9c31782baf20c6b7ef764af.png)  
[View.zip](https://forum.inductiveautomation.com/uploads/short-url/emiqyJ0mtcvfNRnH1ECYbMpwMoJ.zip) (3.5 KB)

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [November 14, 2022, 12:07am UTC](https://forum.inductiveautomation.com/t/script-transform-unexpectedly-return-array/66444/2 "2022-11-14T00:07:38Z")

</div>

Okay, having it all laid out in front of me in one post, I spotted the comma after `yes`

🙃

---

<div class="post-metadata">

**Author:** ![humphrey.daniel](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@humphrey.daniel](https://forum.inductiveautomation.com/u/humphrey.daniel)\
**Post date:** [November 14, 2022, 4:27am UTC](https://forum.inductiveautomation.com/t/script-transform-unexpectedly-return-array/66444/3 "2022-11-14T04:27:11Z")

</div>

I think that comma is short form for creating a tuple.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 15, 2022, 4:30pm UTC](https://forum.inductiveautomation.com/t/script-transform-unexpectedly-return-array/66444/4 "2022-11-15T16:30:09Z")

</div>

> [@ASF](#):
>
> Okay, having it all laid out in front of me in one post, I spotted the comma after `yes`

[https://rubberduckdebugging.com/](https://rubberduckdebugging.com/) strikes again.
