Skip to main content

I am trying to use a where filter like so: 

where (a && b) || c

Prettify keeps removing the parenthesis. Doesn’t this mess with the order of operations?

This shouldn’t. The logical operations can be treated similar to arithmetic operations, so it is read left to right. The only instance parenthesis is needed is when operations is done outside the left to right order. For example, there is a difference between 

A || B && C

vs. 

A || (B && C ) 

 

For more info on this, please see https://www.cs.utexas.edu/~dnp/frege/logical-operator-precedence.html


Thanks @jack.shen - that makes sense


Reply