OR function in DesignScript

Hey everyone,
I’m trying to use DesignScript to increase an index based on a parameter. Depending on the paramater it has to add, subtract or keep the same value. I defined an if statement for this. The problem arises when I want to add multiple OR functions. Everything works as it should except for the values that have to stay the same.

When using the || operator it keeps all the items it has to return the same as the index values and if i define the OR function everytime it doesn’t keep the value the same if it should.

I don’t think the indexing is even necessary. Dynamo will iterate through each object automatically, so there should be no reason to step through item by item. You just need to have inputs for the original list, the list shifted down one index, and lists shifted up one and two indices.

It’s also hard to comment on the OR functionality if you don’t show it. :upside_down_face:

How I tried to use the OR functionality is by defining mutiple if statements (for example line 9 till 17). In this case I want the index to stay the same if it has a value of 18, 42 or 66 but for every other value it has to subtract the index by 1. I have no idea if this even works this way, I’m still new to Dynamo and trying to figure out how DesignScript works.

Hope this clears it a bit up?

Hi @guus.winteraeken ,

Using || acts as OR-statement.

I.e.: A < 5 || A > 15 ;

2 Likes

Thank you, this solved my problem.