Placement of parentheses in "and" and "or" options?

Let’s say I am creating a constraint or dynamic expression that returns a boolean value, where “C#” refers to “Condition #”, so that it reads:

C1 and C2 and C3 or C4 and C5 or C6

In the code, where are the parenthesis placed?

For example, this statement could refer to a number of possibilities:

  1. C1 and C2 and (C3 or C4) and (C5 or C6)
  2. C1 and C2 and (C3 or (C4 and C5 or C6))
  3. (C1 and C2 and C3) or (C4 and C5) or C6

Left to right …
(((C1 and C2 and C3) or C4) and C5) or C6

So the rules are

  • When the same operand is used multiple times, that entire block is wrapped in parentheses (e.g. C and C and C and C / C or C or C or C)
  • When a different operand is used, the prior block is closed and a new one starts (e.g. [[[C and C] or C or C or C] and C and C]

Thanks for the clarification!

Interesting way to interpret “left to right”, I doubt you’ll get much luck with it.

To clarify the earlier example…
((((C1 and C2) and C3) or C4) and C5) or C6

It is quite a challenge to express the more complex expressions this way…

2 Likes

Interesting way to interpret “left to right”, I doubt you’ll get much luck with it.

To clarify the earlier example…
((((C1 and C2) and C3) or C4) and C5) or C6

It is quite a challenge to express the more complex expressions this way…

Ah… I see. That is a bit more complicated… Thank you for clarifying.