If conditions and/or null values don't work as expected

Check https://www.reddit.com/r/kustom/comments/fm23a0/are_null_empty_valuesif_conditions_bugged/ for more info.

In short:

1) conditions seem to be read as a whole, even if the first part of an "and" already fails. if(0 and 1) should stop at 0

2) null/empty string values used incorrectly in e.g. subtraction operation because of 1) cause the whole condition to always be "true"

1 Like

The format appears to be wrong in your examples. I don’t want to have to flip over to reddit to get the details, but basically you have

$if (0 & 1,REMOVE,ALWAYS)$

But what you need is

$if ((0) &(1),REMOVE,ALWAYS)$

Each expression on either side of an boolean operator must be placed in parentheses. For example:

$ if (
(A<10) & (A>0),ALWAYS,REMOVE
)$

I’ve formatted this on multiple lines to make it clearer. The expression will return ALWAYS when a is less than 10 and more than 0. Your example is different in that it if a value (as opposed to comparing two values) but it’s the same principle. It works out in the first part of your example because you have only one test. As soon as you have two, as you do in the second part, each test has to be in parentheses or the whole thing is evaluated as a test of one expression instead of two, giving unexpected results.