Hey guys,
I want to compare each element of one list to all elements of a second list.
In Python I could write:
for i in listA
if i in listB:
"do this"
else:
“do this”
is there and equivalent in DesignScript for “if i in listB”?
Any help is much appreciated.
Thank you.
Looking for something like this?
for loops are also possible in Imperative code blocks.
2 Likes
Similar to what @Mostafa_El_Ayoubi has shown, but without defining a function …
x = [Imperative]
{
a = 1..3;
b = {2,2,3,1};
c = 0;
z = {};
for (i in a)
{
d = 0;
for (j in b)
{
if (j == i)
{
z[c][d] = "ABCD";
d = d+1;
}
else
{
z[c][d] = "wxyz";
d = d+1;
}
}
c = c+1;
}
return = z;
};
1 Like