Code Block with if statement

Hi all!
I try to create a simple if statement in a code block, but as soon as z input is a empty list, it doesnt work anymore. In my opinion it should use the y input regardless of what z is?

Rectangular Duct Weight_2021.dyn (55.7 KB)

thank you,
Thomas

Hi Thomas, try the ScopeIf+ node from the Clockwork Package, i dont know why this doesnt work, it should work.

1 Like

Alternatively, two lines of design script:

indx = x == true ? 0 : 1;
result = [x,y][indx];
1 Like

thanks @Daan & @JacobSmall!
I think Jacobs solution is similar to the ScopeIf+ Node:

result = [trueval, falseval];
result[test ? 0 : 1];

2 Likes