IF OR statements for a list

Good afternoon. Being VERY new to Dynamo, I’m having trouble filtering a list using if/or. I have a graph that places furniture tags for artwork at a set distance from the element. I want to change that distance based on the rotation of the element. Specifically, if the element rotation is either 0 or 180, I want the distance to be 1. All other rotations can be 2. I can filter by one or the other using the == node, but I can’t figure out the || node. I’m also struggling with the ‘formula’ node and simply using a code block. In the snip below, I basically want the circled code block to be “either 0 or 180”.
Any insight would be greatly appreciated.

I’d use the modulo function - the % node. It returns the remainder after dividing the input by the divisor, so if have values of [0 , 45, 90, 162.61529191, 180, 180.000001, 225, 359, 360]; and take the modulo you should get values of [0, 45, 90, 162.61529191, 0, 0. 000001, 45, 179, 0];

Thanks Jacob.
So you’re saying to convert the 180 to a 0 and eliminate the need for the ‘or’ statement altogether? I considered that, but thought using if/or would be easier. Evidently not. :wink:
It worked perfectly!

Thanks again!

To answer your initial question about the OR function, it just takes two boolean arguments and returns which items have at least one true value. So if you were looking for n == 180 or n == 0, you would check both of those conditions individually and then supply their outputs to the || node.


You could also combine these in a codeblock.
image

2 Likes

Thank you, Nick! That’s exactly what I was trying to understand. When I say VERY new to Dynamo, I mean I have like 3 days worth. Getting used to the code blocks and syntax will take me some time.

Thanks again.