A very complex Boolean expression may use several logical operators like the one shown here

## PHP

`(\$x > \$y) || (\$x == 5) && (\$x <= \$z) || !(\$z == 1)`

So, a reasonable question is “which logical operation is performed first?

The order of precedence is: logical complements (!) are performed first, logical conjunctions (&&) are performed next, and logical disjunctions (||) are performed at the end.

 Higher Precedence Lower Precedence Logical Operator ! && ||

## Java, C++, C#

`(x > y) || (x == 5) && (x <= z) || !(z == 1)`

So, a reasonable question is “which logical operation is performed first?”

The order of precedence is: logical complements (!) are performed first, logical conjunctions (&&) are performed next, and logical disjunctions (||) are performed at the end.

 Higher Precedence Lower Precedence Logical Operator ! && ||

## Visual Basic

`(x > y) Or (x = 5) And (x <= z) Or Not(z = 1)`

So, a reasonable question is “which logical operation is performed first?”

The order of precedence is: logical complements (`Not`) are performed first, logical conjunctions (`And`) are performed next, and logical disjunctions (`Or`) are performed at the end.

 Higher Precedence Lower Precedence Logical Operator `Not` `And` `Or`

## Python

`(x > y) or (x == 5) and (x <= z) or not(z == 1)`

So, a reasonable question is “which logical operation is performed first?”

The order of precedence is: logical complements (`not`) are performed first, logical conjunctions (`and`) are performed next, and logical disjunctions (`or`) are performed at the end.

 Higher Precedence Lower Precedence Logical Operator `not` `and` `or`

Notice: You can always use parentheses to change the default precedence.