Beginer's problema: Filter 2 items from 3 lists

Hi guys,

For example I have 3 lists:

L0 = 0,1,2;
L1=1,3,5
L2=2,5,8

after I filter 0 and 5 …I would like my result list to look like this:
Result:
true,false,false
false,false,true
false,true,false

What I have done, with the help of another topic is this, but it doesn’t seem right as the second statement overwrites the first one, I don’t want that… i want to be " it’s either number x or number y"

a==0?
true:false;
a==5?
true:false;

Capture

You just need a slight modification to your current formula:

You’re currently doing this:

a==0?
true:false;
a==5?
true:false;

Change it to this:

a==0?
true:
a==5?
true:
false;

Your current approach is actually outputting two separate lists, one where your variable a is compared to 0 and one where your variable is compared to 5. If you nest one test inside the other, it will evaluate to true if a == 0 or a == 5, otherwise evaluating to false.

2 Likes

An Or statement would work as well.
image

4 Likes

this is off-topic, noob question, what does the #3 in the list mean?

This particular syntax (0..2)..#3..(1..3) equates to (start)..size..(step). In this case, start and step are ranges themselvs, therefore the first range is 0..#3..1, the second is 1..#3..2 and the third is 2..#3..3

2 Likes

Thanks a lot. understood now.

Thanks for the quick reply, I wish I would have posted earlier this problem;
Could you point me where I can find a manual on how to use the code block design code?
I couldn’t find anywhere about this information or the “| |”

Here is the full documentation for DesignScript. || is a logical or operator.

1 Like

It’s the same as the Or node. The best way to learn design syntax (code block design code) is to learn the nodes and how they work and then to use “Node to code” to convert them to the equivalent code block.

1 Like