# Lists + If Statements

**URL:** <https://forum.dynamobim.com/t/lists-if-statements/69967>\
**Category:** Uncategorized\
**Created:** [November 3, 2021, 2:29pm UTC](https://forum.dynamobim.com/t/lists-if-statements/69967 "2021-11-03T14:29:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruthparr](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@ruthparr](https://forum.dynamobim.com/u/ruthparr)\
**Post date:** [November 3, 2021, 2:29pm UTC](https://forum.dynamobim.com/t/lists-if-statements/69967/1 "2021-11-03T14:29:22Z")

</div>

Hello Forum - I’m running into an issue with Lists and If statements. I tried following the Logic examples from the Dynamo Primer to simplify my issue. When I feed in a list of lists to both True & False, it is giving inconsistent results.  
Sometimes it’s keeping the list structure of the shortest list, regardless of the test. Sometimes it’s using a different structure altogether.  
Ideally I’d get the same list out of the result that I’m feeding in as the True or False input. I’m working at Level 3 for the lists. Is this a known issue? Thanks, as always for your help!

Example 1: True List is shorter: True test gives desired result, False test gives False list cut down to True list’s count + structure.

True Test

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/6/06add79b2b43cdc4def2212e7b55375583766cbd.png)

False Test

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/1/c1b58d9ff285449b87c6345e2e27c7fdf31e33d3.png)

Example 2: False list is shorter. False test and True test both give results with a new list structure that doesn’t match the True or False input lists

True Test

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/e/2ef0ed6ff42ffb6f9e4e361c85a0c8df530cab79.png)

False Test

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/c/3cb7882d76433efa518648a0196bbdf29eb30237.png)

---

<div class="post-metadata">

**Author:** ![EdsonMatt](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/edsonmatt/32/124725_2.png) [@EdsonMatt](https://forum.dynamobim.com/u/EdsonMatt)\
**Post date:** [November 3, 2021, 2:37pm UTC](https://forum.dynamobim.com/t/lists-if-statements/69967/2 "2021-11-03T14:37:01Z")

</div>

Hi @ruthparr

Try this:

> [@Fail to use bool to extract String](https://forum.dynamobim.com/t/fail-to-use-bool-to-extract-string/69765/2):
>
> The if node will always use shortest lacing unless you have the newer version which exposes the lacing controls. One item in the true list, no items in the second list, therefore the most you will get is no items. Can be frustrating at first. Instead you can use a code block like this: indx = test ? 0 : 1; returnedValue = [trueVals, falseVals][indx];

---

<div class="post-metadata">

**Author:** ![ruthparr](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@ruthparr](https://forum.dynamobim.com/u/ruthparr)\
**Post date:** [November 3, 2021, 2:48pm UTC](https://forum.dynamobim.com/t/lists-if-statements/69967/3 "2021-11-03T14:48:49Z")

</div>

> [@Fail to use bool to extract String](https://forum.dynamobim.com/t/fail-to-use-bool-to-extract-string/69765/2):
>
> indx = test ? 0 : 1; returnedValue = [trueVals, falseVals][indx];

Thanks @EdsonMatt for such a quick & accurate response! List structure remains in tact for both true and false tests now

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/3/f35d3bf94dcd9496c4bbb6ae6aae9d2e95ee19ba.png)
