Grouping operands using parentheses

Parentheses allow grouping the expression so that the operands you add are processed in a non-standard order.

Operands inside parentheses are always processed before other operands. Parentheses can also be placed inside parentheses, in which case the operands are processed starting from the innermost parentheses.

We can change the earlier example by adding a set of parentheses like this: (A ⋃ ~(B ⋃ C)) ⋂ D. With the two sets of parentheses, the inner parentheses are processed first (B ⋃ C as before), and the negation is processed next (~X as before). However, the outer parentheses are processed next instead of processing the intersection, changing the result. If ~(B ⋃ C) results in Y (as before), the expression becomes (A ⋃ Y) ⋂ D. The order of processing is then different than without the parentheses: instead of intersecting Y and D, the expression performs a union of A and Y, and the intersection is then the last operand to be processed.

Complicated expressions with extensive use of parentheses can become difficult to read and edit. In these situations, nested expressions might sometimes be a better option.