Issues with rules and brackets

I’m trying to have a rules like such

rules:
    - if: "$PRODUCT && ($SDK_VERSION || $ASSET_VERSION)"

I am expecting if $PRODUCT variable doesn’t exists, the job won’t be triggered. But it triggered anyways. If I do this,

rules:
    - if: "($SDK_VERSION || $ASSET_VERSION) && $PRODUCT"

Then it works as intended. The job won’t be triggered if the $PRODUCT variable is absent.


Similar to this, if $PRODUCT is absent or empty, this job will run with the following rules…

rules:
    - if: "($SDK_VERSION || $ASSET_VERSION) && $PRODUCT == 'ABC'"

I’m expecting (true || false) && false == false and not trigger this job