# How are AND and OR operators handled?

Hey all!

When I set conditions (Only when) on an action, and include several steps of logic to it, what are the rules that Bubble abides by when it comes to AND and OR operators? Is there an easy way to say how the mathematics of it works?

For example:

Only when: 1=“yes” and 2=“yes” OR 3=“yes”

Would this be interpreted by Bubble as:
Only when: [1=“yes” AND 2=“yes”] OR [3=“yes”]
(both 1 and 2 must be true OR 3 must be true)

Or

Only when: [State_yes=“yes”] AND [State_no=“yes” OR [State_maybe=“yes”]
(1 must be true OR 2 or 3 must be true)

Ignore the formal rules of logic, Bubble is using left to right, so:

Only when: (1=“yes” and 2=“yes”) OR 3=“yes”

2 Likes

Awesome, thank you @mishav

@mishav
So does “left to right” mean it just start with the first two and tacks on each subsequent element?
Like it doesn’t matter if the operator is “or” or “and”?

(A or B)
((A or B) or C)
(((A or B) or C) or D)

2 Likes

That’s right. A somewhat messy workaround for example for (A and B) or (not A and not B) is something like …

Checkbox A is checked and Checkbox B is checked or Website home URL:find & replace is yes

The find & replace is …

Checkbox A isn’t checked and Checkbox B isn’t checked:formatted as text

The formatted as text is yes, no.

2 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.