And in CL: Are Parentheses needed?

If I’m in the CL and using
when STUFF

If I want to test multiple things where it says STUFF,
I know to use and in between each item.
Is it OK to do this:

thisA and thisB and thisC and thisD
Or do I need to use parentheses:
(thisA and thisB) and (thisC and thisD)

If () aren’t required, then I’m guessing “order of operations” would be left to right?

I’ve been playing around with different things and couldn’t figure out whether or not the parentheses were needed.

In that case you don’t need parentheses, (it doesn’t matter how CL combines the “AND” calls, you’ll always get the same answer) but if you’re in a place where you’re guessing about / relying on whether they’re needed then it’s usually safer / easier to read if you just include them.

It’s also fairly important to use parentheses when you have more complex conditionals with combinations of OR and AND conditions.
For example:
x1 = when true and true or true and false 1 otherwise 0 --> results in 0
x2 = when true and true or false and true 1 otherwise 0 --> results in 1
so putting in appropriate and necessary parentheses clarifies your conditional (and results in less errors)

Thanks! That’s what I was thinking, but wanted to make sure…and wasn’t trusting my mental capacity to run an experiment! :slight_smile:

Thanks! That’s what I thought.