Create list from If else statement using code block

dynamo

#1


Hi all, I have two kinds of list for coordination, for instance there is two types of list for x =[a,b,c,d] z=[e,f,g,h] and x=[a1,b1,c1,d1] z=[e1,f1,g1,h1], and a varible p=, I want if p>4, and i will get x =[a,b,c,d] z=[e,f,g,h], else x=[a1,b1,c1,d1] z=[e1,f1,g1,h1], unfortunately I cant make it work, can anyone help me?
Many Thanks


#2

Dynamo 1.3 or Dynamo 2.x?


#3

Dynamo 2.x


#4

Hi,


#5

Oh! I see!! But what if I wanted it in a single node?it is there anything wrong with the code?
many thanks

xt= ["a","b","c","d"];
zt=["e,"f","g","h"];
xf=["a1","b1","c1","d1"];
zf=["e1","f1","g1","h1"];

x = p>4?xt=[]:xf=[];
z = p>4?zt=[]:zf=[];


#6

Try this instead :slight_smile:

xt= ["a","b","c","d"];
zt=["e","f","g","h"];
xf=["a1","b1","c1","d1"];
zf=["e1","f1","g1","h1"];

x = p>4?xt:xf;
z = p>4?zt:zf;

Or this :

x = p>4?["a","b","c","d"]:["a1","b1","c1","d1"];
z = p>4?["e","f","g","h"]:["e1","f1","g1","h1"];

#7

Thx!!You made my day!!


#8

Glad I helped :slight_smile: