# Switch between numeric values passes when value is true/false

Is this working as designed ? Should true/false pass ?

Neither `true` or `false` are numbers, thus probably passes through as extraneous data?

EDIT Actually, it is accounting for the binary "value" of the Boolean, AKA 1 or 0, as confirmed by changing the switch values from 0-255 to 1-255, thus preventing `false` to pass

Yes that seems to happen here.

I have added an additional switch to make sure that the type matches numeric. I just wonder if this should be handled directly in the case of the "is between".

I suspect it is the way it is meant to be, as there are surely many valid reasons for a `boolean` to be treated by it's numerical value. But if not desired to be treated equally then can easily be overcome with a preceding `switch` using the `is of type = number` filter (~as you have probably done~ EDIT as I reread and see that is exactly as you have done ).

You could handle the bug using a JSONata expression and only use one switch node.

``````\$type(\$\$.payload) = "number" ? 	(\$\$.payload >= 0 and \$\$.payload <= 255) : false
``````

I understand, but it defeats the purpose of the "is between" function

IME true/false Booleans are processed as being equivalent to 1/0 99% of the time in 99% of languages and for 99% of the time this is what we want to happen

Occasionally, it doesn't work out, as in this case

2 Likes

But does it? A Boolean is a binary choice, typically 0 (false) or 1(true), but can also mean 0 (false) and not-zero (true,1,2,3,4,5... infinity). Thus it really does fall "in between" 0 and infinity.

Yes it does. There is no "is between true and false". It all depends on the intention behind the "is between" function, was it designed to make decisions between 2 numbers or was it meant capture the answers of the universe ? If the latter, soit. If not, it would perhaps be nice to exclude them.

My last view/say on this... It works just fine, and since only the inclusion of an (already) easily excludable boolean may affect "subjective perfection" then I still state that it doesn't really matter. But if the devs "fix" it or state it is intentional.... or say nothing, well... that is up to them

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.