I’m trying out ways to fit a conditional statement into a nested for loop.
In the trial example I want to only multiply the content of the first 4 sub-lists with 10, leaving the rest as it is.
The code works only when the IF statement is not in it, what am I doing wrong?
Or is there a different way to use conditional statements inside a for loop?
input;
[Imperative]
{
out = [];
for (i in input)
{
for(j in 0..3) // index counter
{
i[j] = i[j] * 10;
}
out = List.AddItemToEnd(i, out);
}
return out;
};
Thanks for the reply, but for my project I think I need to enumerate the list, to place a conditional statement on the index, is that possible in Design Script?
I need to place tiles on a Chinese hip roof, I want to do it with adaptive family with 4 adaptive points.
To do that I need to sift out the lines with divisions that are shorter than the central lines.
I’m more comfortable in the Dynamo environment, hence my preference of using design script.
I’m aware that you can probably do it with just nodes, but the next step might involve me sifting out the distance of the last point to see if I can fit an entire tile in that space.
So using design script is a middle ground for me not going into Python.
It’s often possible to simplify the logic by separating steps in Dynamo. No need for an Imperative statement here when you can write a straight conditional.