Null == false results true

Having an issue with the list of bools

Let’s say I have a list of bools combined with nulls

[null,null, false,false, null,null]

When I check whether items in list == false, I get the result for all of them as true. I tried changing lacing, also played with code block, levels etc. But it’s the only result I get.

I know that I can find a way around. But I’m just curious is it an expected result, or not? Faced such an issue several times before.

Revit 2024.3
Dynamo 2.19

1 Like

This is expected. The == node uses truthy falsy equivalence with boolean values. This means that it’s evaluating the object’s “truth-ness” or “false-ness” rather than an actual boolean value.

3 Likes

I suggest cleaning null values before feeding them into the design options is primary.

2 Likes


Hello, did you try those nodes?

Ok, now it’s starting to make a sense :partying_face:

Thanks for your examples, I didn’t know about this truthy falsy behavoiur in Dynamo before.

Cheers

2 Likes

@Andriy in your case you could try using an Object.IsNull and Math.Xor nodes to exclude the nulls

1 Like