# IF node and list formation

**URL:** <https://forum.dynamobim.com/t/if-node-and-list-formation/63891>\
**Category:** Lists-Logic\
**Created:** [May 12, 2021, 7:44pm UTC](https://forum.dynamobim.com/t/if-node-and-list-formation/63891 "2021-05-12T19:44:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![de.ge](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@de.ge](https://forum.dynamobim.com/u/de.ge)\
**Post date:** [May 12, 2021, 7:44pm UTC](https://forum.dynamobim.com/t/if-node-and-list-formation/63891/1 "2021-05-12T19:44:50Z")

</div>

Hi all, can anyone explain to me why I get an empty list as a result from the IF node, even though I should be getting the six items on the left?

 ![scrn1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/c/0cd1becfb4912fa8016c77ef58cbc54743369a3b.png)  
It seems to be working if I change the List.Empty node with a Code block, I guess this means I am not using List.Empty correctly?

And one more question - how should I set the false value of the IF statement if I want my end result to be 0? Right now it seems to be cycling through a list which I thought should only be accessed if the result was True, and replacing each item of the list with 0s.

 ![scrn2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/0/d01b7816174eb449c26e008960ea4da0f50f1a08.png)

I’d like the result if True to be a list of items and if False - an empty list or a 0.  
Sorry if this has been discussed before, I’ve been looking for an answer for hours

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [May 12, 2021, 7:45pm UTC](https://forum.dynamobim.com/t/if-node-and-list-formation/63891/2 "2021-05-12T19:45:38Z")

</div>

> [@"If node" Dynamo](https://forum.dynamobim.com/t/if-node-dynamo/63844):
>
> I have a curve that I want to discretize in order to position the reinforcement. If I set the condition “False” with the Boolean node I want to discretize by one step and the “If node” returns the correct number of discretizations. If I set the “True” condition with the Boolean node I want to discretize by the number of reinforcements, but the “If node” does not return the exact number of discretizations (11 instead of 30).

---

<div class="post-metadata">

**Author:** ![de.ge](https://avatars.discourse-cdn.com/v4/letter/d/e274bd/32.png) [@de.ge](https://forum.dynamobim.com/u/de.ge)\
**Post date:** [May 12, 2021, 10:13pm UTC](https://forum.dynamobim.com/t/if-node-and-list-formation/63891/3 "2021-05-12T22:13:58Z")

</div>

Thanks. I ended up replacing the node with this and it worked

> [@Help with IF Conditional Statement](https://forum.dynamobim.com/t/help-with-if-conditional-statement/12697/9):
>
> The if node has been bothering me for quite some time. I have created my Python node that works like an IF. It might not be brilliant code but it gets the job done. """ Replacement of Dynamo IF node """ \_\_author\_\_ = Daniel Gijsbers \_\_version\_\_ = '1.0.0' # Enable Python support and load DesignScript library import clr # The inputs to this node will be stored as a list in the IN variables. ToF = IN[0] # a boolean List1 = IN[1] List2 = IN[2] Result = [] if ToF == True: Result.append(List1) e…
